Closed WiZaR5789 closed 10 months ago
You are looking for a feature which is missing in ESPHome as far as I know. At the moment only the state (on/off) of a light entity can be restored easily. This doesn't include the brightness and color/colortemp.
Do you have any idea how to bypass this, or do I rather need to learn to live with it and that's it?
I've extended all my automations by the expected default (colortemp + brightness):
action:
- service: light.turn_on
entity_id: light.nursery
data:
brightness_pct: 100
color_temp: 370
In this case the previous state of the light doesnt matter anymore. Sometimes I've a input_number
per room to be able to pick up some easily configurable defaults:
action:
- service: light.turn_on
entity_id: light.nursery_nightlight
data_template:
brightness_pct: "{{ states('input_number.nursery_light_brightness_double_click')|int(1) }}"
color_temp: 370
# ...
- service: light.turn_on
entity_id: light.nursery
data_template:
brightness_pct: "{{ states('input_number.nursery_light_brightness_single_click')|int(100) }}"
color_temp: 370
This is another workaround to manipulate some settings on boot to avoid unloved states:
# https://github.com/syssi/philipslight
esphome:
name: "${hostname}"
platform: ESP8266
board: esp_wroom_02
board_flash_mode: dout
includes:
- common/custom_components/xiaomi_light.h
on_boot:
then:
- light.turn_on:
id: bulb
brightness: "$brightness_on_boot"
color_temperature: 333mireds
Please don't copy&paste the complete code block. The on_boot
section is the relevant part for you!
It's some idea, thanks. I'll probably go with the second option.
Hi, do you have any thoughts on how to make an ESP32 (flashed with ESPHome) retain its state after a restart? Currently, with each update or power outage, I have to set the brightness and color from the beginning. If this is a straightforward question and I should know the answer, please point me in the direction where I can find it. Below, I'm providing YAML with code for ESPHome, which I am using.
yldl01yl:
ylxd013-b: