Trying to turn off my light when I turn off the tv/Apple TV

I am trying to set up my light via wemo smart plug to turn off when I turn off the tv/Apple TV after 11 pm. It is not working so far.

What am I doing wrong?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
id: ‘1619200434598’
alias: Turn off Living room Light w/ remote
description: ‘’
trigger:

  • platform: device
    type: turned_off
    device_id: c69d0bb88d04e6998dcb59ca505a0c3a
    entity_id: remote.living_room
    domain: remote
    condition:
  • condition: time
    after: ‘23:00:00’
    weekday:
    • mon
    • tue
    • wed
    • thu
    • fri
    • sat
    • sun
      action:
  • type: turn_off
    device_id: bf9734d41b042acd4b1ba8fdb443fbac
    entity_id: switch.wemo_living_room_light
    domain: switch
    mode: single

Hi and welcome!

Did you build the automation via automation editor? Please, could you post your code using the </> button ?

How do I use that button

  1. Paste your code into the editor window.
  2. Highlight that code snippet.
  3. Click the button above with the </>-icon

preformatted-text-button


id: '1619471534244'
alias: Turn off living room light with Apple TV
description: Turn off living room light with Apple TV
trigger:
  - platform: state
    entity_id: media_player.living_room_2
condition: []
action:
  - type: turn_off
    device_id: c69d0bb88d04e6998dcb59ca505a0c3a
    entity_id: remote.living_room
    domain: remote
  - type: turn_off
    device_id: bf9734d41b042acd4b1ba8fdb443fbac
    entity_id: switch.wemo_living_room_light
    domain: switch
mode: single
* platform: device
type: turned_off
device_id: c69d0bb88d04e6998dcb59ca505a0c3a
entity_id: remote.living_room
domain: remote
condition:
* condition: time
after: ‘23:00:00’
weekday:
  * mon
  * tue
  * wed
  * thu
  * fri
  * sat
  * sun
action:
* type: turn_off
device_id: bf9734d41b042acd4b1ba8fdb443fbac
entity_id: switch.wemo_living_room_light
domain: switch
mode: single

But which state of your media player shall trigger the actions?

The second automation runs from 23:00:01 til 23:59:59

the first automation is the one I am working with after looking around on here for similar. The second one is the first one and I thought it wasn’t work because I wasn’t using a state trigger.

Basically what I want to do is have the light turn off when I turn the Apple TV / tv off after 11 pm.

it would be from on to off

I don‘t use Apple TV. Why the remote has to be turned off?


  trigger:
  - platform: state
    entity_id: media_player.yourmediaplayer
    to: 'off'
    from: 'on'
  condition:
  - condition: time
    after: '23:00:00'
  action:
  - service: switch.turn_off
    target:
      entity_id: switch.yourswitch
  mode: single


the media_player.yourmediaplayer is the Apple TV. its not the remote, but the Apple TV itself.

still looking for some help on this if anyone is out there. I would appreciate the guidance.

I have tried this and nothing happens.


alias: turn off light with TV
description: turn off light with TV
trigger:
  - platform: device
    type: turned_off
    device_id: c69d0bb88d04e6998dcb59ca505a0c3a
    entity_id: remote.living_room
    domain: remote
condition: []
action:
  - wait_for_trigger:
      - platform: device
        type: turned_off
        device_id: bf9734d41b042acd4b1ba8fdb443fbac
        entity_id: switch.wemo_living_room_light
        domain: switch
mode: single

Did you try my example above?

Yes it didn’t work. I tried it a couple of ways trying to turn off the Samsung tv or Apple TV.

neither did the trick.

alias: turn off light with TV
description: turn off light with TV
trigger:
  - platform: state
    entity_id: media_player.samsung_smart_tv
    to: 'off'
    from: 'on'
condition: []
action:
  - service: switch.turn_off
    target:
      device_id: bf9734d41b042acd4b1ba8fdb443fbac
mode: single

Look at the target, switch is missing.


entity_id: switch.wemo_living_room_light

so like this?

alias: turn off light with TV
description: turn off light with TV
trigger:
  - platform: state
    entity_id: media_player.samsung_smart_tv
    to: 'off'
    from: 'on'
condition: []
action:
  - service: switch.turn_off
    target:
      entity_id: switch.wemo_living_room_light
mode: single

let me try it.

That didn’t work. I set the Samsung tv as the trigger and also tried it with the Apple TV. neither worked.

I am not sure what the trace does but this what I got.

Executed: May 1, 2021, 5:26:01 PM

Result:
params:
  domain: switch
  service: turn_off
  service_data: {}
  target:
    entity_id:
      - switch.wemo_living_room_light
    device_id:
      - bf9734d41b042acd4b1ba8fdb443fbac
running_script: false
limit: 10

Did you copied my example 1:1? Please go to automation editor, open the concerned automation and switch to yaml mode.
Looks like you have to much quotation marks in the on/off section.