Hi everyone, I’m hoping to get some help with an automation I’m trying to setup.
What I’m trying to achieve is for an input boolean to display whether the TV (LG WebOS TV) is on or off. This, I can achieve fairly easily however I’m waiting to build in automaiton to turn on and off the TV with the same boolean. This way, the state of the TV will be somewhat synced to HASS if the TV remote is used instead of HASS.
I’m having a few issues though and I’m sure it’s relating to templating (which I haven’t got my head around yet). When I first tried the automation was looping and the TV would turn on and off at random.
So I stripped it back a lot to only change the boolean when the TV is turned on.
Here’s what I’ve currently got.
automation/tv_state.yaml
- alias: set tv state input boolean
trigger:
- platform: state
entity_id: media_player.living_room_tv
state: 'playing'
action:
service: homeassistant.turn_on
entity_id: input_boolean.tv_state
input_boolean.yaml
tv_state:
name: TV
initial: off
icon: mdi:television
Any chance someone can give me a hand to get it setup properly?