Jyagoda
(Jyagoda)
April 2, 2022, 12:15pm
1
I have made an automation to turn on and off my outside light at sunrise and sunset. They will shut off during sunrise, but will not turn on at sunset. I have followed a few Youtube videos on how to do this, but can’t find the error.
thanks,
Justin
description: ''
trigger:
- platform: sun
event: sunrise
offset: 0
id: Sunrise
- platform: sun
event: sunset
offset: 0
id: Sunset
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: Sunrise
sequence:
- choose:
- conditions:
- condition: trigger
id: Sunrise
sequence:
- service: switch.turn_off
data: {}
target:
entity_id: switch.front_porch_light_1
device_id:
- be8d2341b4b929173bc351221a6faa49
- conditions:
- condition: trigger
id: Sunset
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.front_porch_light_1
device_id:
- d358b7881e89ad1cf1d6b35f779a8c14
- be8d2341b4b929173bc351221a6faa49```
It might be easier to see in UI, but the only trigger id being checked is Sunrise. There is a choose trigger id of sunrise, then another unneeded check for sunrise or sunset.
description: ''
trigger:
- platform: sun
event: sunrise
offset: 0
id: Sunrise
- platform: sun
event: sunset
offset: 0
id: Sunset
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: Sunrise
sequence:
- service: switch.turn_off
data: {}
target:
entity_id: switch.front_porch_light_1
device_id:
- be8d2341b4b929173bc351221a6faa49
- conditions:
- condition: trigger
id: Sunset
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.front_porch_light_1
device_id:
- d358b7881e89ad1cf1d6b35f779a8c14
- be8d2341b4b929173bc351221a6faa49
Arh
April 2, 2022, 12:51pm
3
If it was me I would setup a night and day sensor using sunrise and sunset Times of the Day - Home Assistant
then create automation that turns the light on if its night and off if its day The night and day sensor is useful in so many automation’s.
Use elevation of the sun, as mentioned in dozens of other posts here:
https://www.home-assistant.io/docs/automation/trigger/#sun-trigger
The problem with using sunrise and sunset in automations is that midnight and the date change come into play…
The first part of your action is choose with only the sunrise as a condition.
- choose:
- conditions:
- condition: trigger
id: Sunrise
sequence:
- service: switch.turn_off
data: {}
target:
entity_id: switch.front_porch_light_1
device_id:
- be8d2341b4b929173bc351221a6faa49
- conditions:
- condition: trigger
id: Sunset
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.front_porch_light_1
device_id:
- d358b7881e89ad1cf1d6b35f779a8c14
- be8d2341b4b929173bc351221a6faa49
Jyagoda
(Jyagoda)
April 4, 2022, 1:45am
6
All,
Thank you very much for all of you help, I believe I found the error.
Thanks,
Justin