Difference between revisions of "MM Defender NodeMCU Configuration Page"

From PalOMoney
Jump to navigation Jump to search
m (Explain that web page functionity can augment controller code. Emphasize control label words.)
 
(4 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
  
[[File:MMSetupWeb r1.png|right]] This is the revision 2 web page. Actually, the web page is being continuously tweaked. An inordinate amount of time was spent copying and modifying the supposedly royalty-free mosquito artwork and adding two extraneous controls to hide and fade the mosquitos. We are not ace web designers here.
+
[[File:MMSetupWeb r1.png|400px|right]] This is the revision 2 web page. Actually, the web page is being continuously tweaked, because it may be possible to add functionality to the system using just the web page. This is important because the controller code is as big as it can be without running out of memory. But the file system has lots of space. While experimenting, an inordinate amount of time was spent copying and modifying the supposedly royalty-free mosquito artwork and adding two extraneous controls to hide and fade the mosquitos. We are not ace web designers here.
  
The page should be split up into 3 separate pages: a status and command page, an MQTT broker setup page, and a WiFi instructions and reconfiguration page.
+
The page should be split up into 3 separate pages: a status and command page, an MQTT broker setup page, and a WiFi instructions and reconfiguration page. Right now it is one long page.
  
 
== Status ==
 
== Status ==
  
The status line displays the most recent message sent to the MQTT broker.
+
The status line displays the most recent message sent to the MQTT broker. At present, there are no command buttons. It would be useful to have a few:
 +
* Restart the trap startup sequence, waiting for cool down (to 40 C).
 +
* Ditto, without waiting for cool-down.
 +
* Generate a "manual off" error code to turn the trap off after a cool down.
 +
* A message format toggle to simplify the MQTT and status messages.
  
 
== MQTT Settings ==
 
== MQTT Settings ==
Line 19: Line 23:
  
 
The settings are:
 
The settings are:
* Login
+
* MQTT Server Login
** Broker is the address of the broker server you wish to use.
+
** <i>Broker</i> is the address of the broker server you wish to use.
** Port is the port on that server that provides the service you want, typically 1883.
+
** <i>Port</i> is the port on that server that provides the service you want, typically 1883.
** User is the user name for brokers that require a login
+
** <i>User</i> is the user name for brokers that require a login
** Password is the corresponding password.
+
** <i>Password</i> is the corresponding password.
 
* Topic and Client ID
 
* Topic and Client ID
** Topic is the topic to which the system publishes. It is organized similarly to file folders and names.
+
** <i>Topic</i> is the topic to which the system publishes. It is organized similarly to file folders and names.
 
*** The system subscribes to the topic that starts with the topic with the letter 'Q' appended and listens for commands.
 
*** The system subscribes to the topic that starts with the topic with the letter 'Q' appended and listens for commands.
** Client ID is a unique string of characters that identify this particular unit. It can be numeric, or anything you want, as long as it is unique to the broker.
+
** <i>Client ID</i> is a unique string of characters that identify this particular unit. It can be numeric, or anything you want, as long as it is unique to the broker.
 
* Command Buttons
 
* Command Buttons
** Save saves the MQTT settings and restarts the MQTT session. Both the publish and subscribe topics are reconfigured.
+
** <i>Save</i> saves the MQTT settings and restarts the MQTT session. Both the publish and subscribe topics are reconfigured.
** Restart reboots the system. This will restart the trap, as well. The trap can take several minutes to cool down before it restarts.
+
** <i>Restart</i> reboots the system. This will restart the trap, as well. The trap can take several minutes to cool down before it restarts.
** Stop Web Server will stop the server that supplies this page until the next reboot. Use this to prevent tampering with the system.
+
** <i>Stop Web Server</i> will stop the server that supplies this page until the next reboot. Use this to prevent tampering with the system.
* Silly Display Controls
+
* Display Controls
** Ok, these are there just to see how much work can be off-loaded to javascript. If javascript is disables, they do nothing.
+
** These are there just to see how much work can be off-loaded to javascript. If javascript is disables, they do nothing.
** Hide/Show Mosquitos alternately toggles between mosquito background and a simple soothing pattern.
+
** <i>Hide/Show Mosquitoes</i> alternately toggles between mosquito background and a simple soothing pattern.
** Fader (unlabeled) fades the background image in and out. It's fun!
+
** <i>Fader</i> (unlabeled) fades the background image in and out. It's fun!
  
 
== Wireless Settings ==
 
== Wireless Settings ==
Line 62: Line 66:
 
=== The Controls Below ===
 
=== The Controls Below ===
 
* Specify Access Point
 
* Specify Access Point
** SSID sets the wireless access point's SSID.  
+
** <i>SSID</i> sets the wireless access point's SSID.  
** Password sets the required password.
+
** <i>Password</i> sets the required password.
 
* Buttons
 
* Buttons
** Save saves the new configuration and restarts the WiFi  
+
** <i>Save</i> saves the new configuration and restarts the WiFi  
** Restore Defaults erases any wireless configuration and starts over with the controller access point.
+
** <i>Restore Defaults</i> erases any wireless configuration and starts over with the controller access point.
 +
If you can figure out a better way to write this, please let us know!

Latest revision as of 14:06, 28 June 2018

MM Defender NodeMCU Configuration

MMSetupWeb r1.png

This is the revision 2 web page. Actually, the web page is being continuously tweaked, because it may be possible to add functionality to the system using just the web page. This is important because the controller code is as big as it can be without running out of memory. But the file system has lots of space. While experimenting, an inordinate amount of time was spent copying and modifying the supposedly royalty-free mosquito artwork and adding two extraneous controls to hide and fade the mosquitos. We are not ace web designers here.

The page should be split up into 3 separate pages: a status and command page, an MQTT broker setup page, and a WiFi instructions and reconfiguration page. Right now it is one long page.

Status

The status line displays the most recent message sent to the MQTT broker. At present, there are no command buttons. It would be useful to have a few:

  • Restart the trap startup sequence, waiting for cool down (to 40 C).
  • Ditto, without waiting for cool-down.
  • Generate a "manual off" error code to turn the trap off after a cool down.
  • A message format toggle to simplify the MQTT and status messages.

MQTT Settings

The software implements an MQTT client that publishes its status 'topic' to an MQTT broker for viewing on a PC or phone app. It also receives commands.

MQTT is a very light-weight and fast messaging system suited to Internet-of-Things devices that have only very tiny resources (computing power and memory). The IOT device publishes (sends) a message on a certain topic to a server (called a broker). Another device (e.g., a PC or phone) connects to the broker and subscribes to that topic. The broker delivers the received message to whoever has subscribed to the topic, and holds the latest message for a while so that other clients that later subscribe to the topic can get it.

There are free and paid broker servers. You can set up your own broker service using free software. Some brokers require a user name and password. Internal brokers, and / or user names and passwords make the service more private and secure. This is more important for a connected front door lock.

The settings are:

  • MQTT Server Login
    • Broker is the address of the broker server you wish to use.
    • Port is the port on that server that provides the service you want, typically 1883.
    • User is the user name for brokers that require a login
    • Password is the corresponding password.
  • Topic and Client ID
    • Topic is the topic to which the system publishes. It is organized similarly to file folders and names.
      • The system subscribes to the topic that starts with the topic with the letter 'Q' appended and listens for commands.
    • Client ID is a unique string of characters that identify this particular unit. It can be numeric, or anything you want, as long as it is unique to the broker.
  • Command Buttons
    • Save saves the MQTT settings and restarts the MQTT session. Both the publish and subscribe topics are reconfigured.
    • Restart reboots the system. This will restart the trap, as well. The trap can take several minutes to cool down before it restarts.
    • Stop Web Server will stop the server that supplies this page until the next reboot. Use this to prevent tampering with the system.
  • Display Controls
    • These are there just to see how much work can be off-loaded to javascript. If javascript is disables, they do nothing.
    • Hide/Show Mosquitoes alternately toggles between mosquito background and a simple soothing pattern.
    • Fader (unlabeled) fades the background image in and out. It's fun!

Wireless Settings

Actually, these are reconfiguration settings. If the wireless is not connected to an access point, the system creates its own access point, and this web page is not available. Instead, the simple page shown is displayed.

The topic is mostly instructions. The instructions are supposed to be simple. However, nothing is simple when it comes to connecting to WiFi. The key points are:

  • If connected to WiFi, this web page re-configures WiFi (to another access point in range).
  • If not, it creates its own access point for WiFi configuration.

It may help to reproduce the instructions here:

  • When not connected to a wireless network, the controller creates its own access point named "SetupGadget_######" where '#' is some number.
  • Connect to that access point, and open any web address (e.g., google.com) to display a web page with a list of access points with good reception.
  • Select or enter an SSID and enter the password.
  • Note: the controller access point and web page is on only when the controller does not have a wireless connection.
  • If you can now access this web page, the controller does have a wireless connection, so its access point is not on.
  • If so, use the controls below. You can change and save the access point, or just restore the defaults to erase it.
  • If it doesn't work, restart or power cycle the controller to start over.

The Controls Below

  • Specify Access Point
    • SSID sets the wireless access point's SSID.
    • Password sets the required password.
  • Buttons
    • Save saves the new configuration and restarts the WiFi
    • Restore Defaults erases any wireless configuration and starts over with the controller access point.

If you can figure out a better way to write this, please let us know!