ESPhome: save energy in a cute way

Want to save energy with my bk7231n-based device. My plan is to used a dozen of them and even 0.25…0.5W may count. If my measure is right it consumes around 1W. As far as I know, most consuming part is WiFi.

Hence there is a question whether it make sense to let sleep the wifi (or reduce wifi-power) for a while.
I am aware that Wifi (and in my case MQTT) is the (only) way to communicate with server. But I could imagine to let is sleep for 2min or even for 15min at night. My hope would be that exchange of data is than done after a reconnect.
I am not aware what might consume more energy: keep the connection or re-establish connection from time to time and let wifi sleep inbetween.

Assume the server set a command at 23:00 - it would be fine if the real execution happens at night up to 10min later. But the command shouldn’t rejected. Will this be assured if I set qos to “1” instead of “0” ?

May deep_sleep help in this case? What are your experieces?

Using deep sleep you reduce A LOT of energy.

A “good” ESP board could be use 10-20uA in deep sleep instead 80-120mA in normal mode with WiFi (6600 times less!!!)

Mh, good point to mention ESP here. Deep sleep only mentiones the ESP chips. Not sure the other hardware is just not added or not support that at all.

This is a great idea, not only to save power, but also to extend the life of the devices. Smart plugs would last much longer as they would be able to cool down during deep sleep periods, and capacitors wouldn’t blow up that easily.
Has anyone been able to test this on Beken chips?

Can some think of a way to only activate deep sleep during night time?.. I have a solar powered board, which I do wanna have online, but if kept running it drains down the battery a night. I wouldn’t mind to have it in deep sleep while I’m in deep sleep myself if you know what I mean…

Perhaps a feature could be implemented, which would allow home assistant to trigger deep sleep via automation?

For Esp32 you can simply do that on esphome with
on_time: automation.
Not valid for Beken though.

do you by any chance have an example somewhere which you can post?

Google magically redirects here :point_down:

After some reading, I configured mine like so:

deep_sleep:
  id: deep_sleep_1
  sleep_duration: 15min

switch:
  - platform: template
    id: my_sensor_enter_sleep
    name: "Enter Deep Sleep"
    assumed_state: False
    turn_on_action:
      then:
        - deep_sleep.allow: deep_sleep_1
        - deep_sleep.enter: deep_sleep_1
    turn_off_action: 
      then:
        - deep_sleep.prevent: deep_sleep_1

that created a toggle switch which initiates deep sleep. I can now use automation to trigger it

Looks kinda over engineered for your simple task, why not use something outlined in the docs :point_down:

# ESP32 can sleep until a specific time of day.
on_...:
  then:
    - deep_sleep.enter:
        id: deep_sleep_1
        until: "16:00:00"
        time_id: sntp_id

Looks very handy to sleep the night :zzz: