Per this pull request, and more specifically this YAML example here triggers for light objects should work, but it doesn’t work for me. I get this when I try to run:
Failed config
light.binary: [source zentec-alt.yaml:23]
platform: binary
name: Laundry Light
id: thelight
output: relay
restore_mode: ALWAYS_OFF
[on_turn_on] is an invalid option for [light.binary]. Please check the indentation.
on_turn_on:
- switch.turn_off: redLED
[on_turn_off] is an invalid option for [light.binary]. Please check the indentation.
on_turn_off:
- switch.turn_on: redLED
Here are my yaml files,. I am running the latest esphome 1.14.5. Hopefully I’m just missing something obvious… The only reason I’m trying to do this is because most of the devices I have hooked up to these relays are lights, so I want them to appear as lights in HA.
laundry-light.yaml
substitutions:
device_name: laundrylight
friendly_name: Laundry Light
ip_address: 10.0.2.5
<<: !include common.yaml
<<: !include zentec-alt.yaml
zentec-alt.yaml
binary_sensor:
- platform: gpio
pin:
number: GPIO13
mode: INPUT_PULLUP
inverted: true
name: "${friendly_name} Button"
on_press:
- light.toggle: thelight
status_led:
pin:
number: GPIO02
inverted: true
output:
- platform: gpio
pin: GPIO12
id: relay
light:
- platform: binary
name: "${friendly_name}"
id: "thelight"
output: relay
restore_mode: ALWAYS_OFF
on_turn_on:
- switch.turn_off: "redLED"
on_turn_off:
- switch.turn_on: "redLED"
switch:
- platform: gpio
name: "redLED"
id: "redLED"
pin: GPIO4
inverted: true
restore_mode: ALWAYS_ON
internal: true
common.yaml:
esphome:
name: ${device_name}
platform: ESP8266
board: esp01_1m
wifi:
ssid:
password:
fast_connect: on #we only have one WiFi AP so just use the first one that matches
ap: #since we listed an SSID above, this AP mode will only enable if no WiFi connection could be made
ssid: ${friendly_name}_AP
password:
use_address: ${ip_address}
# Enable logging
logger:
baud_rate: 0 #disable UART logging since we aren't connected to GPIO1 TXlogger:
# level: DEBUG
# Enable Home Assistant API
api:
# Enable OTA updates
ota:
safe_mode: True
# Enable web server
web_server:
port: 80