first of all sorry for my bad english.
I want to do an automation based on my sony android tv and a WLED led strip that I installed behind tv.
I would like to turn on led strip when tv turn on and turn off when tv turn off. In my configuration.yaml I added this line for android tv:
media_player:
- platform: androidtv
name: Sony TV
host: xxx.xxx.x.xx
and into automations.yaml I added:
- alias: turn on tv
trigger:
platform: state
to: playing
entity_id: media_player.sony_tv
action:
service: light.turn_on
entity_id: light.wled
This is last configuration. I tried, also, with platform: state and to: on but nothing happens.
Can someone help me?
At first: have you restarted HA or reloaded HA? IF not do that first.
Second: Why do you write the automation directly in the yaml? Using the UI editor is way easier for me.
Third: If you turn your tv off and then on again, what state does the tv have in developer tools?
Have a look at the state_detection_rules mentioned in the docs. I believe with this you can make HA interpret that opening the default launcher package from nothing equals turning the device on. Getting this package name can be optained by executing this: