I am trying to integrate a binary sensor to trigger an RGB LED based on the binary sensor state.
The program works, except after power interrupt, update etc, whereby the RGB remains unlit until a state change (on-push, on_release) of the sensor.
I have tried to use an on_boot instruction, but it is giving error…Unable to find condition with the name ‘garage_door_sensor.is_on’.
Any help or suggestions would be very welcome.
esphome:
name: toady
platform: esp8266
board: nodemcuv2
on_boot:
then:
- delay: 30s
- if:
condition:
garage_door_sensor.is_on:
then:
- output.turn_off: output_red
- output.turn_off: output_green
- output.turn_on: output_blue
else:
- output.turn_off: output_blue
- output.turn_off: output_red
- output.turn_on: output_green
light:
- platform: rgb
name: "RGB LED"
red: output_red
green: output_green
blue: output_blue
output:
- platform: esp8266_pwm
id: output_red
pin: D5
- platform: esp8266_pwm
id: output_green
pin: D7
- platform: esp8266_pwm
id: output_blue
pin: D6
switch:
- platform: gpio
pin: D1
name: "Garage Door Open Switch"
id: open_switch
binary_sensor:
- platform: gpio
pin: D2
name: "Garage Door Closed"
id: garage_door_sensor
device_class: garage_door
on_press:
then:
- output.turn_off: output_red
- output.turn_off: output_green
- output.turn_on: output_blue
on_release:
then:
- output.turn_off: output_blue
- output.turn_off: output_red
- output.turn_on: output_green