Hi all,
I would like to ask for an advice: I am working on some autonomous watering gizmo built on barebone Atmel328p, HomeAssistant and MySensors. As my units run on batteries, I use long smartSleep()s to save power.
The release water command is initiated by controller. After the specific amount of water is released, I would like to send some information back to the controller (remaining amount of water in the tank and the fact that the pump was switched off after the watering was done). Sending this information from within receive() is a no-no, as I learned recently (a lots of !MCO:PRO:RC=1), so instead of sending the outbound messages directly, I put them into a linked queue which is flushed in the loop(). This works, somewhat.
But due to the fact that the receive() is called just before smartSleep(), my messages must wait in the queue till the smartSleep() is finished and they get out only after the unit wakes up again (say, after 30 minutes).
It's not the end of the world, but I have quite a strong feeling I am trying to reinvent the wheel here. Is there some "proper" way how to send out message to controller in a reaction to some received() data? I tried to play with wait() after waking up, but it did not work as I hoped it would.
Many thanks in advance,
Jan