homieiot / homie-esp8266

💡 ESP8266 framework for Homie, a lightweight MQTT convention for the IoT
http://homieiot.github.io/homie-esp8266
MIT License
1.36k stars 308 forks source link

Deep sleep function without interfering with the homie module functions #146

Closed gubagu closed 6 years ago

gubagu commented 8 years ago

Question:

Is it possible to use esp8266's "ESP.deepSleep(microseconds, mode)" function without interfering with the homie module functions (https://github.com/esp8266/Arduino/blob/master/doc/libraries.md#esp-specific-apis) ?

I have in mind enegy efficient sensor that lets say gets measurements publish them to the broker and goes in deepsleep again.

Furhter more i noticed that homie modules report their availability and probably to turn off that function in the energy efficient mode with deep sleep.

Thanks in advance !

Cheerz, Guby

marvinroger commented 8 years ago

Yes, you can use it. The upcoming version will allow you to be notified when one of your message is received by the broker. So you will only have to deep sleep when you receive the notification.

The initial sending of information is only a matter of milliseconds, whereas you need to wait a second to connect to the Wi-Fi / broker anyway, so there's no need to sacrifice this feature to gain like 30ms out of a second or two.

luebbe commented 6 years ago

This may also be of interest to you: Homie and light sleep - How it is done. I needed a sensor that runs on batteries, consumes as little energy as possible but can be woken up by an interrupt or button press without having reboot completely.