2017-08-19
04:28pm


Statement of Purpose

The purpose of the NodeMCU Manager is to provide Registration, Query and Logging services to embedded IoT platforms.

Although this application was designed for use with the NodeMCU, any platform that is capable of issuing a HTTP get request can use these services.

Some of the problems associated with embedded devices include:

  • How do you find the device? (Current IP?)
  • Does the device know the time of day?
  • How can the device alert us of significant events?

To respond to these questions, the NodeMCU Manager provides the following services:

REGISTRATION SERVICES

The node is able to register the fact that it is alive and store the current IP address. This allows us to easily find the node, especially in a DHCP environment where the IP may change each time the node is restarted.

ALERT SERVICES

The node will be able to respond to events and send an email alert to the administrator of the node. The node does not need to have any SMTP client capabilities; the message is passed via a simple webservice.

LOGGING SERVICES

The node can request that a message is to be stored in the logfile associated with the node. This allows the node to record events without using the storage on the node.

TIME SERVICES

Due to the fact that many of the types of nodes do not have a built-in clock, the node can query the NodeMCU Manager for the date and/or time.



Summary of Webservices

Registration Services

register

Sets the current IP address of a node.

By default, the manager will use the actual IP address of the node however it is possible for the node to register an alternate IP address. This would be important if the server is seeing the public IP of the node instead of the LAN address (eg: server is in the cloud).

If the node requires a password, you must set the password on the URL.

Examples:

  • http://server/nodemgr/?register=Node1
  • http://server/nodemgr/?register=Node1&ip=192.168.1.101
  • http://server/nodemgr/?register=Node1&pass=mypassw0rd

setdesc

Sets the description field in the NodeMCU Manager. This can be used to communicate the status of the node to the administrator.

If the node requires a password, you must set the password on the URL.

Examples:

  • http://server/nodemgr/?setdesc=Node1&text=This is some text
  • http://server/nodemgr/?setdesc=Node1&pass=mypassw0rd&text=system ready

getnode

Retrieves the current IP address of a node.

Example:
  • http://server/nodemgr/?getnode=Node1

getdesc

Retrieves the current description text of a node.

Example:
  • http://server/nodemgr/?getdesc=Node1

writelog

writes a line of text to the node's logfile

If the node requires a password, you must set the password on the URL.

Example:

  • http://server/nodemgr/?writelog=Node1&pass=mypassw0rd&text=hello

myip

Displays your IP address as seen by the Node Manager server. If the server is on the same lan as your node, the IP address will probably be the private address as given by your router.

However, if the server is in the cloud, the IP address displayed will be the public address given to your site by your ISP.

Example:

  • http://server/nodemgr/?myip

redirect

This will redirect your browser to the current IP address of your node. This is useful when you want to have a link on a webpage that points to the node but cannot be certain of the current IP address.

Example:
  • http://server/nodemgr/?redirect=Node1


Time Services

A node can query the NodeMCU Manager for the date/time.

CodeFunctionExample
dateDisplays Full Date2015-Oct-12
timeDisplays Full Time02:19:14pm
time24Display time in 24hour17:04:23
unixtimeDisplay UNIX Epoch time1445872990
weekendIs this the weekend?1
workweekMon-Fri? 9am-5pm?1
DayDay of Week (text)Mon
dayDay of Week (number)1
MonthMonth (text)Oct
monthMonth (number)10
Year4-digit Year2015
year2-digit Year15
Hour24-Hour Format17
hour12-Hour Format11
ampmam or pmam
minuteCurrent Minute56
secondCurrent Second18

Example:


Alert Services

alert

Sends an email to the address configured for the node.

If the node requires a password, you must set the password on the URL. The node does not require any specific email capabilities, the email is generated by the server.

Example:

  • http://server/nodemgr/?alert=Node1&pass=mypassw0rd&text=Water level is high


Data Services

pushdata

Sends data from the node to the server. The data is logged and the latest data can be viewed via a webpage. Multiple data points can be pushed at the same time.

If the node requires a password, you must set the password on the URL.

Example:

  • http://server/nodemgr/?pushdata=Node1&pass=mypassw0rd&temperature=21&door=open&window=closed

removedata

Removes any stored data from the node on the server. This only removes the webpage data. It does not remove anything from the log file.

If the node requires a password, you must set the password on the URL.

Example:

  • http://server/nodemgr/?removedata=Node1&pass=mypassw0rd

showdata

Displays the latest pushed data from the node as a simple webpage.

Example:
  • http://server/nodemgr/?showdata=Node1