Looking for automation help with media_player

hi all,

I have a couple of automatons that I’m having some problems with, basically one just wont work as i want it to… and the other does the opposite to what id expect…

here are the automations

- id: '0000000000020'
  alias: Turn off lounge TV with sky
  initial_state: 'true'
  trigger:
    entity_id: media_player.skyq_lounge
    platform: state
    to: 'off'
  condition:
    condition: state
    entity_id: media_player.lounge_tv
    state: 'on'
  action:
  - service: media_player.toggle
    entity_id: media_player.lounge_tv

the automation above wont run unless I remove the condition, though as I am only able to use a toggle to turn the power off I want to use the state sensor to determine if the TV is currently on or off, if its off I don’t want to turn it on. is there another way?

The below automation appears to be triggered right after the above automation (i dunno why) with the result, skyQ and tv turn off (without condition) then 3 secs later the tv and skyQ turn back on… can anyone think of how I can amend this to work?

 - id: '0000000000021'
   alias: turn off skyQ with Lounge TV
   initial_state: 'true'
   trigger:
     entity_id: media_player.lounge_tv
     platform: state
     to: 'off'
   action:
   - service: media_player.toggle
     entity_id: media_player.skyq_lounge

The plan/hope is:
that the SkyQ box will be turned off by HA if I/my wife turns off the TV
and
that the TV will be turned off by HA if I/my wife turns off the SkyQ box.

can anyone offer some help?

thank you

Add a condition to the second automation checking if the skyq_lounge is on. The second automation is being triggered because the first automation is turning the TV off, which is the second automation’s trigger.

Also, you really can’t use media_player.turn_off?

1 Like

thank you… think i had a bad case of being the cat…

problem

now to give it a try…

yeah media_player,turn_off wont work for some reason… but I found that media_player.toggle does… weird…

1 Like