[SOLVED] Go to loop(); when parent/gateway can't be found.
-
I have all light switches in my flat running a relay node with local switch.
Recent gateway PSU failure rendered all my lights nonoperational.
PSU tripped RCB and killed gateway, after power was resumed no light switch worked.
All nodes were stuck in endless loop trying to find gateway and never reached loop(), where local switch interactions are programmed.
Is there a way to prevent this? I had no working lights for 3 days before new gateway parts arrived!!!
-
@Sasquatch yes. The keyword to search the forum for is MY_TRANSPORT_WAIT_READY_MS
-
@mfalkvidd If you have time, could you give an example of how @Sasquatch and others (including me!) could use this please?
-
@mfalkvidd Thank You!!!
@skywatch just search forums, plenty of use examples, knowing what to search for was a key problem ;).
-
@skywatch I have never used this feature so I can’t help that much. Based on what I have read in the forums, exactly how you want to use this feature is heavily dependent on the details of each use case so it is impossible to give generic recommendations.
-
@skywatch said in Go to loop(); when parent/gateway can't be found.:
ai tempo, potresti dare un
Just insert this line:
#define MY_TRANSPORT_WAIT_READY_MS 1000
before : #include <MySensors.h>
this is all, so if the Gateway is not available after 1000 Milli seconds, the scketch is performed anyway
-
@sindrome73 Thanks for that - is there a value returned that could be used to indicate if a connection was successful or not? If so it could display on a screen or led to show if connection is running or not.
-
@skywatch I think you should be able to use
isTransportReady()
for this. It returnstrue
if transport is ready and working,false
if not.#define MY_TRANSPORT_WAIT_READY_MS 1000 // Any value > 0 void loop() { if (!isTransportReady()) { // No uplink } }
-
@BearWithBeard
If you omit#define MY_TRANSPORT_WAIT_READY_MS 1000
or define it as 0 and transport is not ready on boot then sketch will never reach loop();
if (!isTransportReady()) { // No uplink }
Is handy for skipping sending data to gateway in fault condition, saves battery/power.
-
@Sasquatch I'm sorry if I've been too implicit in my answer to @skywatch. I assumed that he intended to use it with
MY_TRANSPORT_WAIT_READY_MS > 0
, so he can react to it inside theloop()
, like going to sleep for a while or turning on a LED as he mentioned.
-
@BearWithBeard my bad, looked at wrong post and understood your answer wrong, bloody small text on phones ;~)
-
I usualy have it set at 10000. Give the network some time to connect.