Enable Javascript


User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active
 

Article Index

HOW TO communicate with myST_nodes

First to do: Insert your LOCAL SSID and Password and the IP of your WebSocket Server Node myST_WS_Server.ino in myST_WS.html. Set the IP from the WebSocket Server myST_WS_Server.ino as STATIC in your Router. Then create a Server with this IP in your Router. Use this link to get your own Internet IP address and insert it in myST_WS.html.
WebBrowser:
This myST_WS.html is a very basic but useful tool to communicate with your Nodes. Use the code as a basic for your own (graphic)tool. If your mobile Browser not works with local html-files then use FireFox. With Apple: search Internet for local-to-store solutions or use a server.
Node addresses:
Shared-Paired-Private (Building-Floor-Room) structure:
Shared (building): "00" to "19", Paired(Floor):  "00" to "99", Private(Room):  "00" to "99", and WebBrowser(WebSocket): "WS".
Addresses from room "000000" to room "199999", or post to all rooms on a floor "0000--" to "1999--".
Posting structure:
Always a even number of fields, use a white space or period as dummy field.
Basic commands: |<toRoom(s)>|WS/<fromRoom>|<CMD>|<param>|  (we use a "|" as field delimiter).
And commands: |<toRoom(s)>|<fromRoom>|<fldName>|<valName>|<fld-x>|<val-x>|<fld-y>|<val-y>|<fld-...>|<val-...>|

(example) Item Fields as set in myST_Node.h, both Node "000100" and "000101" (same Building and Floor but other Rooms)
mode: 0/1=manual/night,  status: 0/1=OFF/ON, pause: 0/1=manual/auto (04:00 reset to auto), rise/set=offset to sunrise/set-time.
The Item "lamp" and mode=1, pause=0: ON 10 minutes before Sunset, OFF 10 minutes after Sunrise.
In this case: the same fields/values for the Item "home" ("home" is a (Not)AtHome function and can also send commands to other Nodes).

const char fld {{"name", "mode", "status", "pause", "rise", "set"}, {"name", "mode", "status", "pause", "rise", "set"}};
char val {{"lamp", "1", "0", "0", "10", "10" }, {"home", "1", "0", "0", "10", "10" }};


Basic commands:

From "WS" or from from Addr to Addr:
|<toAddr>|<fromAddr>|......(here we show it with the from-Web-Browser WS address)
|<toAddr>|WS|ITEMS|.|                    get- Items number and name list
|<toAddr>|WS|LIST|item number|      get- Item[n] parameter list
|<toAddr>|WS|DATE(ot)TIME|.|        get- date and time
|<toAddr>|WS|GETTIME|.|             get- UTC/GMT UNIX TimeStamp
|<toAddr>|WS|SUN|.|                 get- today Sunrise and Sunset local time
|<toAddr>|WS|DST|.|                  get- local DST/Summertime yes/no and dates
|<toAddr>|WS|SETTIME|TimeStamp| set- UTC/GMT UNIX TimeStamp (if not using NTP-time)
|<toAddr>|WS|SETDST|0/1|OFFSET|value|  set- 0: use manual "dstOffset", 1: calc DST |<toAddr>|WS|INITVAL|.|             set- the original initial Item values
|<toAddr>|WS|OTA|.|                 start OTA upload, time window 5 minutes ---------------------------------------------------------------------------- |<toAddr>|WS|????|.| get/set Your own added commands ---------------------------------------------------------------------------- Use the LIST Item[n] parameter list to change one or more field values by field names
|<toAddr>|<fromAddr>|<fName>|<vName>|<field-1>|<value-1>|<field-n>|<value-n>|....|....| 000000 or 0000-- private/paired command (-- not accepted by all commands) |000102|WS|name|lamp|mode|2|status|1| private 02: set lamp ON and mode to 2 |0001--|WS|name|lamp|status|1|mode|2| shared --: set lamp(s) ON and mode to 2 -- use this careful, it modifies all paired private Nodes!!! addresses are declared in "myST_??????.ino" and names and values in "myST_Node.h"