Confirming node connected to gateway.
-
I was thinking of adding something to nodes so that when I reboot them I can see at the node if it has connected to the GW or not. Maybe a message on a small oled to confirm successful registration.
What would be the most reliable way to do this?
Can I get some value back from presentation stage?
Is there anything better to do (like get confirmation from the controller)?Maybe I missed the obvious here, but it's late and I have a cold.
-
I was thinking of adding something to nodes so that when I reboot them I can see at the node if it has connected to the GW or not. Maybe a message on a small oled to confirm successful registration.
What would be the most reliable way to do this?
Can I get some value back from presentation stage?
Is there anything better to do (like get confirmation from the controller)?Maybe I missed the obvious here, but it's late and I have a cold.
@skywatch
I look for messages (e.g. presentation) at the gateway to diagnose connections at bootup. And I have a flow in node-red, which shows me, when a node didn't send for some time.You could use a led and blink codes on the node, if you really need a local indicator. A OLED would be a no go with battery powered sensors.
-
Thanks for the reply.
I really just need 'something' at the node so that when I power it on I know that it has successfully established communication with the gateway.
On mains powered units it could be a message on a display, on battery units it could be number of flashes of an led.
I do not know 'how' I can do this. Is there some response at the node that I can monitor/interrogate to find out if successful connection has been made with a remote gateway?
-
Here's an example from some of my code, specifically the SETUP function.
void setup() { Serial.begin(115200); // for serial debugging over USB. if(isTransportReady()){ Serial.println(F("Connected to gateway!")); }else{ Serial.println(F("! NOT CONNECTED TO GATEWAY")); } #ifdef HAS_DISPLAY mySerial.begin(115200); wait(1500); mySerial.print(F("CLR(0);")); mySerial.print(F("SBC(0);")); if(isTransportReady()){ mySerial.print(F("DCV16(115,1,w,0);")); } // Labels mySerial.print(F("DCV16(10,155,Barometer,5);")); // Barometer label // Wait icon mySerial.print(F("CIRF(120,239,35,3);")); // Circle as a background //mySerial.print(F("SBC(3);")); //mySerial.print(F("DCV16(105,230,wait,15);")); // Show while the forecast is not available yet. //mySerial.println(F("SBC(0);")); wait(400); #endif if(!bme280.init()){ Serial.println(F("! Sensor error")); #ifdef HAS_DISPLAY mySerial.println(F("DCV16(10,250,Sensor error,1);")); #endif } wdt_enable(WDTO_2S); // Starts the watchdog timer. If it is not reset once every 2 seconds, then the entire device will automatically restart. }Personally I then display a "w" icon in the top-right of the screen if a connection has been made.
In the loop code it requests an ACK whenever it updates the sensor values to the gateway (once a minute). There is also a simple incrementing counter byte that increases by 1 every time there is no reply. As soon as this reaches 5 (meaning no response from the server for 5 minutes in a row) it prints an " " to the corner of the screen, to indicate the loss of connection.
If data once again arrives in the receive function, then a "w" is once again printed to the top right corner, and the incrementing byte is set back to 0.
-
Here's an example from some of my code, specifically the SETUP function.
void setup() { Serial.begin(115200); // for serial debugging over USB. if(isTransportReady()){ Serial.println(F("Connected to gateway!")); }else{ Serial.println(F("! NOT CONNECTED TO GATEWAY")); } #ifdef HAS_DISPLAY mySerial.begin(115200); wait(1500); mySerial.print(F("CLR(0);")); mySerial.print(F("SBC(0);")); if(isTransportReady()){ mySerial.print(F("DCV16(115,1,w,0);")); } // Labels mySerial.print(F("DCV16(10,155,Barometer,5);")); // Barometer label // Wait icon mySerial.print(F("CIRF(120,239,35,3);")); // Circle as a background //mySerial.print(F("SBC(3);")); //mySerial.print(F("DCV16(105,230,wait,15);")); // Show while the forecast is not available yet. //mySerial.println(F("SBC(0);")); wait(400); #endif if(!bme280.init()){ Serial.println(F("! Sensor error")); #ifdef HAS_DISPLAY mySerial.println(F("DCV16(10,250,Sensor error,1);")); #endif } wdt_enable(WDTO_2S); // Starts the watchdog timer. If it is not reset once every 2 seconds, then the entire device will automatically restart. }Personally I then display a "w" icon in the top-right of the screen if a connection has been made.
In the loop code it requests an ACK whenever it updates the sensor values to the gateway (once a minute). There is also a simple incrementing counter byte that increases by 1 every time there is no reply. As soon as this reaches 5 (meaning no response from the server for 5 minutes in a row) it prints an " " to the corner of the screen, to indicate the loss of connection.
If data once again arrives in the receive function, then a "w" is once again printed to the top right corner, and the incrementing byte is set back to 0.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login