I have a small problem with a automation rule, that doesn’t seem to work as intended. It is 100% me that doesn’t understand the concept of the sunset / sunrise, but heeeeelp
So I have a LED strip that I want to turn on when my TV state if going from Off to On. That part seems to be simple, but I only want that to happen when it is dark outside. So I used the “condition: sun” and set the “after: to sunset”
The only problem is, that it will only work when the sunset is triggered and until 12:00pm / 00:00am.
Here is my automation:
# Living Room
# LED Light TV
- alias: Living Room LED Light TV Turn ON
trigger:
platform: state
entity_id: media_player.samsung_tv_remote
from: 'off'
to: 'on'
condition:
condition: sun
after: sunset
action:
- service: light.turn_on
entity_id: light.led_tv_mbel
- alias: Living Room LED Light TV Turn OFF
trigger:
platform: state
entity_id: media_player.samsung_tv_remote
from: 'on'
to: 'off'
condition:
condition: sun
after: sunset
action:
- service: light.turn_off
entity_id: light.led_tv_mbel
What do I need to change if I want the light to be triggered between the sunset and sunrise?
I just realized one thing.
The Turn on and off works as it should, but then another problem came across.
Lets say someone turns the tv on in the morning and then the sun comes above the horizen. When the TV is turned off, the LED is still on and I will have to manually turn it off.
Would it be possible to do a double condition somehow?
- alias: Living Room LED Light TV Turn OFF
trigger:
platform: state
entity_id: media_player.samsung_tv_remote
from: 'on'
to: 'off'
condition:
condition: sun
after: sunset
action:
- service: light.turn_off
entity_id: light.led_tv_mbel
You could just write another automation to turn the LEDs off at sunrise (if they’re on). Then that wouldn’t happen. It would also tell you exactly when the sun comes up if you’re somehow wrapped in morning telly with the blinds closed or lots of low cloud.
- alias: Living Room LED Light TV Turn OFF at Sunrise
trigger:
platform: state
entity_id: sun.sun
event: sunrise
action:
- service: light.turn_off
entity_id: light.led_tv_mbel
Exactly! Unfortunately I’m facing another issue with my Samsung TV (media player) it doesn’t get updated, so the other rules don’t work at the moment, but I already added that question in another thread