Android tv

Hi trying to set up a quick automation on turn on light if tcl android tv is switched on.
Can get it to work if I use state to playing but not state to on.
Is there a way to use based on the state of the tv power?
I also have a sony TV which has Bravia integration which should work havn’t tried yet.
But for the TCL read up on ADB is this the best way with the newest HA?

thanks

this what I have so far which works if motion or if something is cast. Somethings will play from a PC connected to the Tv so that is why I need power state.


 alias: New Automation
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.motion_basement
    to: 'on'
  - platform: state
    entity_id: sensor.zooz_sensor_basement_staircase_burglar
    to: '8'
  - platform: state
    entity_id: media_player.55s434_ca
    to: playing
  condition: []
  action:
  - type: turn_on
    device_id: 21346a439c9549b598cb875e00d6b33c
    entity_id: light.gym_light
    domain: light
  mode: single

no-one has an android tv :slight_smile:

Are you sure your android tv reports “on”. Mine does not, it reports “idle” when on but not playing.

ok just checked if playing youtube example
media_player.55s434_ca says playing. If I stop youtube it says off.
Home assistant seems to have found the casting feature of the tv but not tv itself.

My fault missed the part where you asked if you should setup ADB. That is what I use and has alot more features than the cast integration like the ability to send specific button commands. I’d recommend setting that up, keeping in mind it will create a separate entity for the tv.

ok i will try that thanks

Ok tried but unfortunately on the android TCL TV’s ADB debug is not available. accessed developer mode and ADB was not there. Called TCL and said this option is not available.
My Sony does but do not really need since there is a HA integration in HA created.
Any other way around this?
I know I can tell google to turn on TCL Tv and turn off and works so must be some way of checking it’s status?
I can use the playing function to activate my automation but like mentioned the problem is when I connect my PC to play games.
Thanks

Might be out of luck from a direct integration standpoint. Other option would be a smart plug with energy monitoring, trigger when the power consumption is at whatever level means the tv is on.
Or go the pc integration route and add a trigger for when certain games are running (not that I know this to be possible but I assume so, maybe EventGhost?)

I use that on a non bravia Sony tv to tell if it is on or off. You could then trigger your automation off the state of the binary sensor; understanding it doesn’t instantly update. I only use it to track the on/off state in a smartIR media player component. You could also use one of the tp link kasa plugs/strips that track power usage. I use that to monitor the power on a ‘dumb’ A/V receiver which is controlled via broadlink commands.

Thanks to all The ping will be to slow to react and if I use a ping every 5 seconds or so not sure how continuous ping will react to HA.
I will try the current monitoring plug instead. Hopefully it reacts right away or a second or two would be fine.