General area when it fits no where else

Moderator: Mmiscool

User avatar
By Electroguard
#52313 Firstly, that [BROADCAST] code I gave you was meant as a replacement for the existing [BROADCAST] subroutine in order to make the local Broadcast message Send facility work correctly to manually broadcast messages to other nodes (and the debugger) for test purposes etc - so it wasn't for adding, it was for overwriting.

It allows you to locally send commands to other named nodes in exactly the same way that you can from the debugger utility. The message which is broadcast is whatever you enter into the message window (which I believe by default is ALL BLINKS) then click the Send button.

So you could send "Node140 ON" to see if your new node can receive and action it, or alternatively you could send the same message from the debugger utility... either way, if the named node is online it should action the command, which proves it is ok.


But that isn't how you are controlling Node146 from the master is it... you have hard-coded udpwrite 'On' and 'Off' commands specifically addressed to Node146 into the relevent subroutines of Node210, therefore when those messages get sent, only that specific named node will respond... even though all the other nodes should hear the same message but ignore it because it's not meant for them.

If you want to cause other nodes to take actions as well, you need to add other udpwrite commands specifically addressing those other required node(s) with the required command(s).

So effectively you need to shout an instruction to node146 for it to respond to, then you need to separately shout an instruction to node 140 for it to respond to. And if you later add a voice announcer node, you will need to shout another instruction specifically at that for it to respond to. And don't forget that they will each respond in the order you shout at them.

If you know the commands are always going to be the same that you want transmitted to a group of nodes, then you can address a single common message to their group name rather than repeating it for a list of individual unique names, so all members of that group name will recognise that they each need to action the same message.

The default group name is 'ALL', so sending "ALL BLINKS" will cause each node in the ALL group to blink (in case you're trying to physically locate them). If you only want to find a particular node, you address it by its unique node name, ie: node210 blinks.

That's why I made the point that it's worth giving some thought to node and group names before you start hard-coding names into the nodes and making it much harder to optimise later.

EasyNet nodes don't use IP addresses as such, but by default they do create a unique node name from the IP address to avoid duplicate default names - but that was only done for prudence, you'd be better advised to assign them meaningful names, such as ACmaster, ACslave1, etc.

This may seem a moot point at the moment, but consider what would happen if they lost their dhcp leased addresses and were assigned different ones when they reboot in the future after a power failure or router replacement, their newly created names may no longer correspond to the address names you've hard-coded messages to.

So don't forget that you can change any and all of the various defaults and save them to non-volatile flash if you wish, and they will automaticall keep their assigned names etc even after a reboot.

I'm deliberately giving you more info than you may need at this moment so that you might better take advantage of some of the EasyNet functionality which may not be so obvious or apparent. But you're already doing well Joe, and I'm pleased with where you're going with it.
User avatar
By joeman2116
#52341 Electroguard,

1. I actually did overwrite the old [BROADCAST] code.

2. I agree with changing node names to something more meaningful, makes sense. After I get 2 slaves to work it will be my next project.. Initially, I am trying some basics. Seemed easy enough to make 1 slave , so in testing my theory it should be easy to duplicate. I appears I am making an error on my second slave.

3. Code I added to the master Node210 to make 2 slaves

[toohotcolor]

wprint "<head>"
wprint "<meta http-equiv='refresh'content='5;URL=/input?'>"
wprint "</head>"
wprint "<body bgcolor='#0088cc'>"
wprint "</body>"
udpwrite netIP & "255" , val(udpport) , upper("Node146") & " " & upper("ON")
udpwrite netIP & "255" , val(udpport) , upper("Node140") & " " & upper("ON")
return

[coolcolor]

wprint "<head>"
wprint "<meta http-equiv='refresh'content='5;URL=/input?'>"
wprint "</head>"
wprint "<body bgcolor='#00b386''>"
wprint "</body>"
udpwrite netIP & "255" , val(udpport) , upper("Node146") & " " & upper("OFF")
udpwrite netIP & "255" , val(udpport) , upper("Node140") & " " & upper("OFF")
return

3. Node146 works(master Node210 turns relay on and off)

4. I copied the working Node146 code to Node140.

5. UDP debugger reports both Nodes code been sent but only the Node146 actually reacts.

6. Cant think of a forward solution , I may have to redo the esp node146 in case there is some erroneous in the firmware. I have several extra esp8266.. may just do another and dump the default.bas to it..

Thanks for the excellent details... Printing out the help responses and building a reference manual for future reference. I always do this so I can rebuild in the future..
...

Joe :D
User avatar
By Electroguard
#52348 Ok, so let's concentrate on the problem Node140.

I don't know whether you are manually assigning your IP addresses or if they are being dished out from a dhcp server. If you are manually assigning addresses then there's always the possibility of mistakes or accidental duplicates. Either way, turn off the problem node, then try pinging its ip address to make sure nothing responds.
If no hidden responders, turn it back on, give it time to come up and connect to wifi, then try pinging it again.

If it's on the network, browse to its web page. Click Edit and make sure it loads its script, then Run, and check its details. Make sure it's name is actually Node140, and that it shows the correct IP address - not just its .140 node address, but make sure the subnet is also correct.

If all that is ok, try sending "LOCAL ON" from the nodes Broadcast message window, and it should turn on it's relay. If ok, send "LOCAL OFF" to turn the relay back off.

Try sending "All BLINKS" from the nodes window and check that the udp debugger can receive the message.

If so, try sending "ALL BLINKS" from the debugger, and check if the node blinks its led.

If so, try sending "Node140 BLINKS" from the debugger, and see if it specifically responds to that.

If so, send "Node140 ON" from the debugger, and check if that works.
If it works, then you know that Node140 is receiving and responding correctly.

So if there's still a problem when sending the same message from your Master (Node210) it suggests there must be some sort of typo in its hard-coded udpwrite line.

The code looks like it should be ok - except... it looks like you have got spaces before the commas in the lines, which may be fine, but it certainly caused problems between the Upper () !

Somewhere down that list of steps something should point you to where the problem must be, whether that's a network problem, a name problem, a node140 slave problem, or a node210 master problem. Once you start tackling things in a logical sequence it shouldn't be too hard to point to where the problem must be, even though it might take a bit longer to find it.

Try those things first, but bear in mind that corrupt flash memory can screw with variables and branches and cause some inexplicable symptoms, so if all else fails, try a reformat and reflash of node140 to be sure of starting with a clean slate.
Good luck.
User avatar
By Electroguard
#52393 Hey, Forlotto, we need your wealth of experience to help Mike debug V3 (which I haven't even run since its initial release).

And listen, if you were to go over to the Arduino.cc forum and post a question, the odds are that some unhelpful plonker with a postings rating over a million would reply with something irrelevent or belittling just to boost his own ratings and ego at your expense. Those sorts of people now seems to outnumber the genuinely helpful ones like Nick Gammon by 100 to 1, so you don't have much chance of actually receiving useful help from that forum nowadays.
Maybe I've just been unlucky, but of the dozen questions I've posted there, none were answered effectively by someone who new the answer - and unbelievably... the last a-hole who tried to convince me his Serial example did not suffer from the buffer overflow problem I was trying to avoid, actually accused me of sabotage when I proved it did buffer overflow, and then used his godlike powers to prevent me from posting anything again. So hopefully you can understand my sensitivity on the matter.

Thankfully these ESP8266 forums do not reward such unhelpful responders by elevating their postings score into outer space and turning them into omnipotent gods, but if they did, your score would undoubtedly be by far the highest - which judging by the Arduino forums example is not necessarily a good indicator of the value of a persons contributions, is it.

In your case, the astronomical viewing figures of your excellent NodeMCU Getting Started Guide already prove the value of your contributions, so being irrelevently prolific merely detracts from the excellent value of your contribution.

Think of it like this...if you were deliberately trying to emulate those arduino.cc egos chasing their high score god status, then consider yourself in the spotlight and resent it if you like - but if you are a genuinely helpful contributer as I know you are, please be thankful if I have been able to open your eyes in time to stop you unintentionally becoming what you wouldn't want to be.

This forum needs your experience forlotto, and you are the best person able to answer Mikes call in his V3 bug hunt, so I hope you continue to do what you're good at... using your wealth of experience to offer people the benefit of your help.

Sincerely, Robin.