Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Using the Sleep command you can instruct Tasmota to sleep for the set milliseconds in its main cycle. While sleeping your device will consume less power.
As of 188.8.131.52 Dynamic Sleep is enabled by default with a value of 50. To continue using Normal Sleep you may disable it by using the command:
Sleep to lowest value
1 reduces power consumption already about ~30% in idle mode (relay off) and button presses are still noticed without any delay. Setting this around 50 ms reduces power consumption from ~1.1 W to ~0.6 W on an idling (relay off) sonoff and button presses are still noticed correctly. With this setting you have to concentrate very hard to click the button so fast that it is not recognized by the device.
If your Sonoff needs to do something continuously, this will be affected. E.g. Sonoff LED will flicker and Sonoff POW will not be able to correctly total the energy consumption. Spot readings of power, voltage, etc. will however remain correct.
From the release notes: Expect overall button/key/switch misses and wrong values on Sonoff Pow
Also, if using KNX IP Protocol, sleep needs to be 0 in order to avoid losing any telegram.
- Starting with Tasmota 184.108.40.206
0has no anymore impact on realtime related commands like
- As the WiFi Modem on an ESP8266 is the major consumer - using Sleep with WiFi AP mode enabled is more or less without effect.
Sonoff power consumption and measurement
The result of the most low price plug-in home energy meters are very imprecise for power consumption < 10 W and become more and more imprecise for power consumption like Sonoff devices have (< 1.5 W); furthermore the results of such meters are depending very strong of the load type (capacitive/inductive) and is absolutely imprecise for non-ohmic load types having switch-mode power supply like Sonoff devices.
Additonal to that, using Sleep - which periodicaly cycles the power of the Sonoff between 20% and 100% - the result of such meters are more or less useless.
Example of power consumption
Absolute AC line measurement using calibrated meter
Sonoff power consumption using Sleep
|Device||Sleep 0||Sleep 1||Sleep 50||Sleep 200|
|Sonoff Dual R2||1.24 W||0.84 W||0.76 W||0.68 W|
|Sonoff S20||1.11 W||0.77 W||0.59 W||0.51 W|
All measurements were done with
- WiFi STA mode, enabled and connected (70%)
- MQTT enabled and connected
- Syslog enabled and connected
Teleperiod 60for debuging
- relays off
- measure period of 24-56 h to reduce measuring fault
The first impression is that a higher sleep value reduce the consumption, but slightly. The second result is that using
Sleep <value> (
value ≠ 0, e. g. 1) is enough reducing the power consumption at minimum 1/3 up to 45 % (value=200).
Quantity measurement of ESP-12 module/ESP8266 3.3V line
To find out why Sleep reduce the power consumption and with which quantity, the 3.3 V DC current of ESP8266 of an ESP-12 module was measured using an oscilloscope and (for easy reading the oscilloscope diagram) a 1 Ω shunt which results in a 1:1 interpretation between voltage and current.
This measurement simplified the measure of a time based power consumption; no integration must be done. On the other side note that the quantity measurement does not respect the effectiveness of the complete Sonoff circuit.
Sleep 0 there are no
delay() calls in Tasmota main loop and therefore the power consumption is continuous at current ~80 mA:
Due to the fact that the Tasmota main loop now calls
delay() (even with 1 ms) it seems it results in peroidically (100 ms) enabling the WiFi Modem Sleep mode within the WiFi Manager library. It results in periodically lowering the current to 15-20 mA for periodically ~90 ms:
Further increasing the sleep value there are more and more ~90 ms periods with additonal lowering the current to 8-10 mA - I realy don't know where this comes from:
As already noticed with
Sleep 100 the number periods having 8-10 mA instead of 15-20 mA are again increasing:
The quantity measurement confirms the suspicion that a sleep value ≠ 0 results in reduce the power consumtion about 1/3.