How v2 Gateway with local sensors to delay messages?
-
If trying to understand how to add a local sensor to a mysensors v2 gateway.
void loop() {
// Send locally attached sensor data here
...
send(voltage_msg.set(voltage / 1000.0, 3));}
I want to add a sensor here. I did and it send like every second (seen in the log of domoticz). So what do I do to only send like every 30 seconds a sensor value?
-
If trying to understand how to add a local sensor to a mysensors v2 gateway.
void loop() {
// Send locally attached sensor data here
...
send(voltage_msg.set(voltage / 1000.0, 3));}
I want to add a sensor here. I did and it send like every second (seen in the log of domoticz). So what do I do to only send like every 30 seconds a sensor value?
Welcome to MySensors @TriXwooD !
You use sleep() or wait(). sleep() if you don't expect incoming radio messages, wait() if you do.
See https://www.mysensors.org/download/sensor_api_20#waiting for details
You can also look at one of the examples, like https://github.com/mysensors/MySensors/blob/development/examples/LightSensor/LightSensor.ino
-
Yes I got that from the examples. But my question is: on the gateway itself, which has to do something to talk to the other nodes (?). If I add a sensor to the gateway itself, then what do I do? Can I use sleep()? will the gateway function properly?
Ok I tried wait(), for some reason wait() did not worked before, (got only one message) now it works...
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