On at boot ESPhome Sonoff pow

Hello,

My Sonoff pow is working great with ESPHome and Hassio but I want to switch it on while booting after power failure!

Is this possible?

Regards.

1 Like

Use the on boot event:

thnx, looks like it’s working!

Hi,
Can you share ESPHome configuration for SonOff Pow ?

This is my config:

esphome:
  name: sonoffpow_01_esphome
  platform: ESP8266
  board: esp01_1m
  on_boot: 
  - switch.turn_on: relay

wifi:
  ssid: "??"
  password: "??"

# Enable logging
logger:
  baud_rate: 0
  level: verbose

# Enable Home Assistant API
api:
  password: '??'

ota:
  password: '??'

uart:
  rx_pin: RX
  baud_rate: 4800

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO0
      mode: INPUT_PULLUP
      inverted: True
    name: "Sonoff POW 01 Button"
    on_press:
      - switch.toggle: fakebutton

switch:
  - platform: template
    name: "Sonoff POW 01 Relay"
    optimistic: true
    id: fakebutton
    turn_on_action:
    - switch.turn_on: relay
    - light.turn_on: led
    turn_off_action:
    - switch.turn_off: relay
    - light.turn_off: led
  - platform: gpio
    id: relay
    pin: GPIO12

output:
  - platform: esp8266_pwm
    id: pow_blue_led
    pin:
      number: GPIO13
      inverted: True

light:
  - platform: monochromatic
#    name: "Sonoff POW 01 Blue LED"
    output: pow_blue_led
    id: led

sensor:
  - platform: wifi_signal
    name: "Sonoff POW 01 WiFi Signal"
    update_interval: 60s
  - platform: uptime
    name: "Sonoff POW 01 Uptime"
  - platform: cse7766
    update_interval: 2s
    current:
      name: "Sonoff Pow 01 Current"
    voltage:
      name: "Sonoff Pow 01 Voltage"
    power:
      name: "Sonoff Pow 01 Power"
1 Like

@tom_l will you please help me out in this please. i have a RGBW bulb running esphome how can i set fixed color and brightness on boot? for example on boot set color to red and brightness 80%

this how my config

esphome:
  name: rgbw_test
  platform: ESP8266
  board: esp01_1m
  on_boot: 
  
wifi:
  ssid: "xxxx"
  password: "xxxxxxxx"

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:


sensor:
  - platform: wifi_signal
    name: "WiFi Signal h801light"
    update_interval: 60s
  - platform: uptime
    name: "Uptime h801light"
    
    
#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
1 Like

I’ve never used this service but from reading the docs I think you need:

esphome:
  name: rgbw_test
  platform: ESP8266
  board: esp01_1m
  on_boot: 
    then:
      - light.turn_on:
          id: h801_light
          red: 80%
          green: 0%
          blue: 0%
          white: 0%

also

light:
  - platform: rgbw
    name: "H801 Light"
    id: "h801_light"     ###  <------ Think this is required, id may be generated from Name: though, not sure. Can't hurt to add it
    red: pwm_r
    green: pwm_g
    blue: pwm_b
    white: pwm_w

As I said in the comment above, I’m not sure if a device id defaults to the name (but with all lower case letters and with spaces replaced by _ ) or not. You could experiment with and without the id: in the light config and see if it still works. Either way it should not hurt to specify the id and a name.

i will try this out when i get back home thank you.

@tom_l thank you so much it worked.

1 Like

Did you need the light id, or just the name?

i had to use id without id he gives an error " id is required option [for light.turn on]"

1 Like