- Wed Aug 03, 2016 6:42 am
#52016
Hi joeman2116.
I haven't touched anything since I published it, and I'm not in a position to be hands-on with ESP_Basic any time soon, so all I can do is tell you what I was doing and how I was doing it.
The EasyNet framework was to allow addressing of nodes simply by their assigned names, without even needing to know their IP addresses.
In the mentioned example, any and all received UDP messages cause a branch to [UDPMAIN], where it checks its own node name and group name and global name for matching against the incoming udp msg, and if name is recognised as valid for that local node, then the received udp msg command is compared against internally recognised lists of [LOCAL_COMMANDS], [GROUP_COMMANDS] and [GLOBAL_COMMANDS], and then branched to accordingly.
[LOCAL_COMMANDS] already recognises 'ON' and 'OFF' udp commands which branch to [RELAYON] or [RELAYOFF] accordingly, so that already suits your needs.
A few lines into [UDPMAIN] is [MAIN] which is the non-udp entry point for commands sent to the 'local' node from itself. This makes it possible to check for correct local command recognision and operation by addressing as 'LOCAL' rather than by network node name.
So in its own local Send window, if you enter 'LOCAL ON' for instance, it should turn on the local relay. This lets you check out your network command functionality locally and without any network complications.
Once you have two or more nodes networked, you can manually send them appropriate 'NODENAME COMMAND' instructions from the Send windows, ie: 'Node216 ON". This allows you to test out the network commands interactivity between required nodes. You can also do similar by sending the same messages from cicciocb's udp tool.
In answer to your question, you need to be issuing that same udp network command from whatever event subroutine that you wish to trigger the remote network command from, such as perhaps [TOOHOT] or [TOOCOLD], therefore just include an appropriate udp broadcast of the required 'other node name and command', such as...
udpwrite netIP & ".255", udpport, upper("Node216") & upper(" ON")
It's not essential to convert to upper because I'm fairly sure I made the program do it automatically for all incoming names and commands, but it doesn't hurt and is better than having any wrong case recognition problems.
B.T.W. - to prevent problems with duplicate default node names, I made the EasyNet framework default to a name of "Node" + IP address, so I assume your 2 mentioned nodes have been issued DHCP addresses of .216 and .218 (you can have them flash out their IP addresses on the local led by using the local button).
I'm only making the point because node216 and node218 are not meaningful - so if you are going to be hardcoding with network node names for interaction, perhaps it would be useful to rename your nodes to something more meaningful such as LoungeStat or GREENHOUSE1 or Slave or whatever, then you'll intuitively know what's what even in a years time.
Hopefully that should give you enough to keep you going.
The program didn't work properly on V3 and I didn't have the heart for continuing, so as it stood it only worked on V2. But I suspect the problems may have been screen-related, in which case perhaps your html mods may have changed things. Anyway, perhaps you would be kind enough to post up your prettier version for the benefit of us non-html unfortunates?