Is there a way to check presence of a MySensors network, and proceed without if not found ?
-
I have a question I could not answer based on the documentation:
Is there a way to check presence of a MySensors network, and proceed without if not found ?
I would like to make a device that connects to a MySensors network if there is one, but can go into "standalone" mode if no network is present.
Right now it seems the node keeps trying to connect and never reaches the setup() function. It does pass the before() function.
@gertsanders said in Is there a way to check presence of a MySensors network, and proceed without if not found ?:
I have a question I could not answer based on the documentation:
Is there a way to check presence of a MySensors network, and proceed without if not found ?
I would like to make a device that connects to a MySensors network if there is one, but can go into "standalone" mode if no network is present.
Right now it seems the node keeps trying to connect and never reaches the setup() function. It does pass the before() function.
This should be the default behavior IMHO. Otherwise, your node just hangs and is a nightmare to troubleshoot for new users.
-
@gertsanders said in Is there a way to check presence of a MySensors network, and proceed without if not found ?:
I have a question I could not answer based on the documentation:
Is there a way to check presence of a MySensors network, and proceed without if not found ?
I would like to make a device that connects to a MySensors network if there is one, but can go into "standalone" mode if no network is present.
Right now it seems the node keeps trying to connect and never reaches the setup() function. It does pass the before() function.
This should be the default behavior IMHO. Otherwise, your node just hangs and is a nightmare to troubleshoot for new users.
-
@neverdie by "this", do you mean the current MySensors behavior, or the behavior suggested by gertsanders?
I'm not sure if the current default behaviour of MySensors is to wait for 5 seconds before giving up and moving on. I was under the impression that a node would try to find a network until my hair grows back.
When the define is included in the sketch, it clearly does it's job.
@NeverDie probably meant that we should not need to set the define, unless we want to change the default 5sec wait time, or if we explicitly want to have the node hang until a network is found.
So the question is, is the default behaviour to keep looking for a network, or does the library stop after 5sec and move on with the setup() ?
-
I'm not sure if the current default behaviour of MySensors is to wait for 5 seconds before giving up and moving on. I was under the impression that a node would try to find a network until my hair grows back.
When the define is included in the sketch, it clearly does it's job.
@NeverDie probably meant that we should not need to set the define, unless we want to change the default 5sec wait time, or if we explicitly want to have the node hang until a network is found.
So the question is, is the default behaviour to keep looking for a network, or does the library stop after 5sec and move on with the setup() ?
@gertsanders according to the documentation, the default value is 0 which means to wait forever.
Where did you get the 5 seconds from?
-
@gertsanders according to the documentation, the default value is 0 which means to wait forever.
Where did you get the 5 seconds from?
@mfalkvidd from an example where it mentioned
#define MY_TRANSPORT_WAIT_READY_MS 5000I would expect this to be the default, and not '0'
-
@mfalkvidd from an example where it mentioned
#define MY_TRANSPORT_WAIT_READY_MS 5000I would expect this to be the default, and not '0'
@gertsanders I see. To me, providing an example that sets the value to its default value would make little sense since setting it would not change anything. But everyone interprets things based on prior experiences, and everyone's experiences are different.
I am unable to find an example that sets MY_TRANSPORT_WAIT_READY_MS in the MySensors git repo. Do you remember where you saw it?
-
@neverdie by "this", do you mean the current MySensors behavior, or the behavior suggested by gertsanders?
@mfalkvidd said in Is there a way to check presence of a MySensors network, and proceed without if not found ?:
the behavior suggested by gertsanders
the behavior suggested by gertsanders
-
@gertsanders I see. To me, providing an example that sets the value to its default value would make little sense since setting it would not change anything. But everyone interprets things based on prior experiences, and everyone's experiences are different.
I am unable to find an example that sets MY_TRANSPORT_WAIT_READY_MS in the MySensors git repo. Do you remember where you saw it?
@mfalkvidd
Nope, I probably got this from a forum message somewhere. I’m not sure where I got the suggestion to use the define.
The thing is, it is very nice to have this #define, but as @Neverdie said, it would be nice to avoid that a node “hangs” if the gateway is unavailable. As far as I can see, there is no DEBUG message if the network is not reachable. And for a new MySensors user a hanging node is really confusing (it is sometimes for me as well). So this #define will now be part of me ‘default’ template until the standard behaviour is adapted. -
@mfalkvidd
Nope, I probably got this from a forum message somewhere. I’m not sure where I got the suggestion to use the define.
The thing is, it is very nice to have this #define, but as @Neverdie said, it would be nice to avoid that a node “hangs” if the gateway is unavailable. As far as I can see, there is no DEBUG message if the network is not reachable. And for a new MySensors user a hanging node is really confusing (it is sometimes for me as well). So this #define will now be part of me ‘default’ template until the standard behaviour is adapted.@gertsanders I think people have posted debug messages like this that indicate that the transport is not ready:
!TSP:SEND:TNRBut that probably only happens when the node is trying to send. If the node is not trying to send, there is no way to determine if transport is available.
-
I think it is logical to have sensors try indefinitely since this is the concept of sensors in a network.
Otherwise you would not know (when not debugging) all is ok in your network.
A network sensor not being one in an usual way, just for convenience (like my BBQ-temp sensor), has to be defined otherwise.