Hi, i have a question about automation of my light behind TV.
I want my backlite to be on if TV is runnning and sun is behind horizont.
2 I want to go auto off if i switch off my TV
This sounds simple but got complicated for me when i have tried to put it in 1 or 2 automations.
alias: TV Licht auto ON
description: Turn on TV Backlite if TV on and sun goes down
trigger:
- platform: sun
event: sunset
offset: 0
- platform: homeassistant
event: start
condition:
- condition: state
entity_id: media_player.samsung_6_series_75
state: 'on'
action:
- service: light.turn_on
target:
entity_id: light.light_led_stripe_tv
data: {}
mode: single
my second automation is
alias: TV Licht auto ON (with TV)
description: Turn on TV Backlite if TV gets on ans sun is down
trigger:
- platform: device
device_id: 9e601bac89a4e1724278d420223da9f2
domain: media_player
entity_id: media_player.samsung_6_series_75
type: turned_on
condition:
- condition: state
entity_id: sun.sun
state: below_horizont
action:
- service: light.turn_on
target:
entity_id: light.light_led_stripe_tv
data: {}
mode: single
if i put the condition from second automation to first i get problems with the sunset trigger…
alias: TV Licht auto ON (Test)
description: Turn on TV Backlite if TV on and sun goes down
trigger:
- platform: sun
event: sunset
offset: 0
- platform: homeassistant
event: start
- platform: device
device_id: 9e601bac89a4e1724278d420223da9f2
domain: media_player
entity_id: media_player.samsung_6_series_75
type: turned_on
for:
hours: 0
minutes: 0
seconds: 2
condition:
- condition: state
entity_id: media_player.samsung_6_series_75
state: 'on'
- condition: sun
before: sunrise
after: sunset
after_offset: '-15'
action:
- service: light.turn_on
target:
entity_id: light.light_led_stripe_tv
data: {}
mode: single
the off automation is simple i just switch off if TV goes off.
which is 15 minutes after sunset but the trigger occurs at sunset.
This option doesn’t appear in your first two automations, only in the third automation that attempts to combine the other two automations. Why did you add after_offset?