Gateway relayed commands
Glad to meet you all
I am not (yet) a user of MySensors, but I am actually looking for a software alternative to a custom setup which implies battery sensors and actuators.
Maybe this feature already exists (and possibly it is also trivial), but unfortunately I'm unable to find a description.
I have built and programmed my own gateway and devices using NRF24l01+ some years ago. I have a special battery powered switch which actually sends some information and then waits a few milliseconds for a command that should come from the gateway and then goes back to sleep for a couple of minutes (I am using Ack payloads with separate channel for this device). However, every two to four weeks, it stops receving the data and unless I power cycle the gateway altogether it does not handle ACKs again. I won't get into more details as I have also other reasons to replace my setup (and I am almost sure this is a hardware issue as I have tried to debug this quite extensively with no positive result).
So, my question is this: Is MySensors (NRF24L01 gateway) able to store a command directed to a dormant device and, when that device wakes up and sends a status message, to receive that as quick as possible?
Or... how can this be done using the available setup and how quick it can be? (for example, in my setup, the gateway acts as MQTT subscriber for the device and prepares the command for when the devices wakes up thus skipping the overhead of MQTT connection/setup/etc).
Welcome to the forum @Constantin-Petra !
MySensors has a feature called "smart sleep" that probably does what you need. The queue is not on the gateway though; the queue is in the Controller. See the table at https://www.mysensors.org/controller for which controllers support smart sleep and https://www.mysensors.org/download/sensor_api_20#sleeping and https://www.mysensors.org/apidocs/group__MySensorsCoregrp.html#gab5f84c4227e3478af4b6600d5e8d8b15 for the MySensors documentation.
Thank you @mfalkvidd !
The "smart sleep" feature seems indeed to do what I want. However, I see two issues for now (I am using Domoticz as Home Automation System):
In the controller description page you have mentioned, "Smart sleep feature" for Domoticz is "n", but I actually find in the Domoticz release history that it was actually implemented (since version 4.9700 - 2018?).
"- Implemented: MySensors: support for SmartSleep option (gateway 2.x)". I also found some loose ends about this, and no convincing further information:
if this is is implemented in the controller, it means it won't be very fast, especially because my gateway is in a remote location, connected through MQTT over VPN via 3G (unless I create a separate Domoticz instance at the remote location itself).
Any new thoughts on this?
@Constantin-Petra the table is updated manually by the community, so it may very well be out of date.
I don't see a problem with the connection to the controller being slow. Just increase MY_SMART_SLEEP_WAIT_DURATION_MS.
Increasing the MY_SMART_SLEEP_WAIT_DURATION_MS would probably work, but I assume this waiting happens while the sensor sketch is running (at least the RF needs to be powered on), thus decreasing battery life.
But I think I will give it a try soon and see what happens.
Thanks for the precious info!