H801 and rgbw platform - restore colour from prevoius state after power off than power on

Hello
I have flashed H801 device with ESPHome firmware.
I use:
light:

  • platform: rgbw
    After flashing everything seems to work good. I can change light colour, I can change brigtness.
    But I have a problem with restore settings after power off and then on power on h801 device.
    After power on it always is setted to default settings. Lets assume I change color to “RED”, than I turn of device using wall switch power off switch, then I power on wall switch, device h801 got power and light turn on but there is default settings (white color) - not RED color as prevoius state before power off.

Is it possible to restore settings from last state after power off than on?

I have read doc and there is paramtere: restore_mode, but it is not what I require. I can set device ON after power on but it does not restore colour setting from previous state.

Any help would be very very nice.

I have resolved problem myself. Standard configuration that is on ESPHome website:
Here is original code:

esphome:
  name: h801light
  platform: ESP8266
  board: esp01_1m
wifi:
  ssid: 'WIFI'
  password: 'WIFIPASS'
  manual_ip:
    static_ip: x.x.x.x
    gateway: x.x.x.x
    subnet: 255.255.255.0
logger:
api:
ota:
sensor:
  - platform: wifi_signal
    name: "WiFi Signal h801light"
    update_interval: 60s
#RGBWarm
output:
  - platform: esp8266_pwm
    pin: 12
    frequency: 1000 Hz
    id: pwm_b
  - platform: esp8266_pwm
    pin: 13
    frequency: 1000 Hz
    id: pwm_g
  - platform: esp8266_pwm
    pin: 15
    frequency: 1000 Hz
    id: pwm_r
  - platform: esp8266_pwm
    pin: 14
    frequency: 1000 Hz
    id: pwm_w
light:
  - platform: rgbw
    name: "H801 Light"
    red: pwm_r
    green: pwm_g
    blue: pwm_b
    white: pwm_w

and it should be modified to:

esphome:
  name: h801light
  platform: ESP8266
  board: esp01_1m
  esp8266_restore_from_flash: true
preferences:
  flash_write_interval: 0s
wifi:
  ssid: 'WIFI'
  password: 'WIFIPASS'
  manual_ip:
    static_ip: x.x.x.x
    gateway: x.x.x.x
    subnet: 255.255.255.0
logger:
api:
ota:
sensor:
  - platform: wifi_signal
    name: "WiFi Signal h801light"
    update_interval: 60s
#RGBWarm
output:
  - platform: esp8266_pwm
    pin: 12
    frequency: 1000 Hz
    id: pwm_b
  - platform: esp8266_pwm
    pin: 13
    frequency: 1000 Hz
    id: pwm_g
  - platform: esp8266_pwm
    pin: 15
    frequency: 1000 Hz
    id: pwm_r
  - platform: esp8266_pwm
    pin: 14
    frequency: 1000 Hz
    id: pwm_w
light:
  - platform: rgbw
    name: "H801 Light"
    red: pwm_r
    green: pwm_g
    blue: pwm_b
    white: pwm_w
    restore_mode: RESTORE_DEFAULT_ON

So I add:

  esp8266_restore_from_flash: true
preferences:
  flash_write_interval: 0s

and

restore_mode: RESTORE_DEFAULT_ON

They are requirde fields to store settings in flash and then restore it.
Maybe it would be usefull for someone else.

1 Like