I have this automation that is correctly checked in config file, but it’s NOT triggered. If i put off the “condition: time” condition it works, but i want this works only between 19h and 00h.
Where i am wrong?
- alias: Regola 1 - Luci alla sera
initial_state: true
trigger:
- event: sunset
offset: '+03:00:00'
platform: sun
# - entity_id:
# - device_tracker.galaxy_s8
# platform: state
# to: home
condition:
- condition: state
entity_id: device_tracker.galaxy_s8
state: home
- after: '19:30:00'
before: '00:00:00'
condition: time
action:
- data:
brightness: 150
rgb_color:
- 0
- 255
- 0
transition: 1000
entity_id: light.gateway_light_7811dcb25b7c
service: homeassistant.turn_on
condition:
- condition: state
entity_id: device_tracker.galaxy_s8
state: home
- after: '19:30:00'
before: '00:00:00'
condition: time
to
condition:
condition: and
conditions:
- condition: state
entity_id: device_tracker.galaxy_s8
state: home
- condition: time
after: '19:30:00'
before: '00:00:00'
Not really sure what you are trying to achieve with the second condition.
This reads to me like you want the light to come on 3h after sunset, but only if your phone is home AND if it’s after 19:30h.
There might not be many cases in the year where 3h after sunset it earlier than 19:30h, i.e. the sun sets before 4:30pm.
Unless, of course, my assumption that you live in Italy is completely off
actually the sun here goes down at 19:20 so i want that automation triggered not before 19:30 and not after midnight. In this case i want my light will be up at 22:20 and finish at 00:00…
Maurizio. 00:00:00 is the beginning of that day so it won’t work as it has already passed and there are no whole seconds before that. Try ‘23:59:59’ instead.
I have one like that
In this way all is working, and if i go out of home, the light will accordingly shut off, but when i will be back at home why the automation is not triggered anymore? No light will be up… how to modify this automation to have the automation coming back when i come again at home? (sorry for my poor english)…
I think this is because of the trigger you used. This only will be triggered once because sunset +3 only happens once everyday.
If you want the light turn on when you back to home, you will need another trigger like device_tracker.galaxy_s8 from not_home to home.