Broadcast message received & how can Node handle incoming messages
-
Hi,
I have a simple system (a sensebender gateway --> VeraPlus and single node that just counts and sends the count every 5 seconds).
I just added the code to read the results of a send command ( I believe this is the hardware ACK), with the goal of rebooting the node if 10 messages are sent without receiving a ACK. I have not yet started to dig into the software ACK.My code has no receive routine (which may be the problem) yet the serial monitor (of the node) reports a "Broadcast message received". I'm not sure what to do with the receipt, I'll assume the gateway wants the node to know something or do something.
Can someone point me to where I might go to understand the Broadcast message and how to gain the most information from it? And if a receive routine should be added for proper / best usage of MySensors.
My goal is to understand what conditions can cause a node to stop working and how to either recover or at least notify the controller (VeraPlus)
Thanks
John
the part of my code with the send command:
// Increment count and send message to gateway if (MyCount == 255){ MyCount = 0; } ACK_Result = send(msg_Voltage.set(MyCount),1); // Test hardware ACK if (ACK_Result == 1){ // blink LED on A0 digitalWrite(LED_TST, HIGH); delay(50); digitalWrite(LED_TST, LOW); NACK_Count = 0; } else{ NACK_Count = NACK_Count + 1; delay(50); // keep both loops ~ the same time. }
Part of the serial monitor output that shows the message sent and ACK received:
2140905 TSF:MSG:SEND,1-1-0-0,s=5,c=1,t=38,pt=1,l=1,sg=0,ft=0,st=OK:40 <- node message to GW with payload (count)= 40 2141114 TSF:MSG:READ,0-0-1,s=5,c=1,t=38,pt=1,l=1,sg=0:40 <- response from GW reflecting the payload (40) 2141174 TSF:MSG:ACK <- the ACK received (with the MSG:READ??) 2146034 TSF:MSG:SEND,1-1-0-0,s=5,c=1,t=38,pt=1,l=1,sg=0,ft=0,st=OK:45 2146243 TSF:MSG:READ,0-0-1,s=5,c=1,t=38,pt=1,l=1,sg=0:45 2146302 TSF:MSG:ACK 2148632 TSF:MSG:READ,0-0-255,s=255,c=3,t=20,pt=0,l=0,sg=0: <- an unsolicited READ coming from GW but how is it recognized by the node? 2148694 TSF:MSG:BC 2149895 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=21,pt=1,l=1,sg=0,ft=0,st=OK:0 2151163 TSF:MSG:SEND,1-1-0-0,s=5,c=1,t=38,pt=1,l=1,sg=0,ft=0,st=OK:50 2151372 TSF:MSG:READ,0-0-1,s=5,c=1,t=38,pt=1,l=1,sg=0:50 2151432 TSF:MSG:ACK 2156293 TSF:MSG:SEND,1-1-0-0,s=5,c=1,t=38,pt=1,l=1,sg=0,ft=0,st=OK:55 2156502 TSF:MSG:READ,0-0-1,s=5,c=1,t=38,pt=1,l=1,sg=0:55 2156561 TSF:MSG:ACK```
-
Hello,
you can use the log parser in the Build section of the website
https://www.mysensors.org/build/parserThen you will see the "read" message is a I_DISCOVER_REQUEST, it's sent with sensor Id = 255 so it's a broadcast message. The debug message is generated by transport layer so it doesn't mater if you have a receive routine or not.
After that your node answers with a I_DISCOVER_RESPONSE message and restarts it's normal life.I_DISCOVER_REQUEST is sent by gateway for network discovery, in order to maintain routing table. You can set the interval by using MY_TRANSPORT_DISCOVERY_INTERVAL_MS configuration key.
-
Hi Nca78,
Thanks for the enlightening reply. Your response shifted my understanding of what was going on. It wasn't quite an Epiphany but very very helpful.BTW I have been using the log parser but I find some of the parsed descriptions are still a bit cryptic. For instance the ACK received message parses to "ACK message, do not proceed but forward to callback".
Also perhaps you know, when I paste into the parser, only the two rightmost columns contain any entries. Is this just how it is or am I doing something wrong?Thanks
John
-
@johnrob said in Broadcast message received & how can Node handle incoming messages:
BTW I have been using the log parser but I find some of the parsed descriptions are still a bit cryptic. For instance the ACK received message parses to "ACK message, do not proceed but forward to callback".
I guess it's because it's made from comments in the source code, so sometimes it explains the behaviour of the code.
Also perhaps you know, when I paste into the parser, only the two rightmost columns contain any entries. Is this just how it is or am I doing something wrong?
Yes I have the same problem, it looks like a bug.
-
@Nca78
Thank you so much for your incite.John