I would like to have an LED on the powerplug to show the status of the light.
I can make this work without any issues with a switch, but if I enter the same commands for a light, I get a no-no.
So I have two buttons, two relays, and two LED’s.
The code looks like this currently:
First I have the buttons defined.
Then the outputs, followed by the switch, and finally the light.
binary_sensor: - platform: gpio id: button1 name: button1 internal: true pin: number: GPIO0 mode: INPUT_PULLUP inverted: true on_press: - switch.toggle: relay1 - platform: gpio id: button2 name: button2 internal: true pin: number: GPIO12 mode: INPUT_PULLUP inverted: true on_press: - light.toggle: relay2 output: - platform: esp8266_pwm id: led1 pin: number: GPIO13 inverted: true - platform: esp8266_pwm id: led2 pin: number: GPIO2 inverted: true - platform: gpio id: light_relay pin: GPIO16 switch: - platform: gpio pin: GPIO14 id: relay1 name: 'server' on_turn_on: - output.turn_on: led1 on_turn_off: - output.turn_off: led1 light: - platform: binary id: relay2 name: freezerlight output: light_relay # on_turn_on: # - output.turn_on: led2 # on_turn_off: # - output.turn_off: led2
The on_turn_on works fine with switches, but if I enter it into the light I get the message:
So how do I get this working?