Hi,
I’m having trouble with an automation with a wake-on-lan switch for a tv.
The switch is set up and working, turns on with WOL and turns off with an IR remote command. The switch also knows what the current state of the TV is (on or off).
I’m trying to set up an automation for a zigbee button that turns off the TV. But I only want the automation to run if the TV is on, as the IR remote command also turns the TV on. So if the TV is off, then the automation should not run.
This is my code:
alias: Sonoff hold press - turn off tv
description: ''
trigger:
- platform: event
event_type: zha_event
event_data:
device_ieee: '00:12:4b:00:22:42:28:6c'
command: 'off'
condition:
- condition: state
entity_id: switch.panasonic_tv
state: 'on'
action:
- service: homeassistant.turn_off
data: {}
entity_id: switch.panasonic_tv
mode: single
It doesn’t seem to work as expected though, if the tv is ‘off’ (and the switch in home assistant also says it’s off) and I trigger the automation, it still sends the IR command to turn off the TV, which just ends up turning it on…
I’m sure it’s something simple, but can’t figure it out