I created this so that I would have an easier way of triggering day and night events in my automations, once this is set you can use your input select instead of using sun as a trigger or condition
To use this you have to create a input select for this with 2 options the first ‘Day’ and the second ‘Night’, ensure they are spelt the exact same way with no spaces at the beginning or end. Once that is done add it to the blueprint select your offset times and your done
This is a very basic blueprint, though it has been much easier for me using this to detect day and night then any other way
blueprint:
domain: automation
name: Easier Day/Night Detection
description: An easier way to detect day and night detection
input:
input_select_day_night:
name: Input Select
description: Add a input select helper here
selector:
entity:
domain: input_select
sunrise_offset:
name: Sunrise Offset
description: Set the elevation of the sunrise see link for specific values https://gml.noaa.gov/grad/solcalc/
default: 0
selector:
number:
max: 10
min: -10
unit_of_measurement: °
mode: slider
step: .1
sunset_offset:
name: Sunset Offset
description: Set the elevation of the sunset see link for specific values https://gml.noaa.gov/grad/solcalc/
default: 0
selector:
number:
max: 10
min: -10
unit_of_measurement: °
mode: slider
step: .1
trigger:
- platform: numeric_state
entity_id: sun.sun
below: !input sunset_offset
attribute: elevation
- platform: numeric_state
entity_id: sun.sun
above: !input sunrise_offset
attribute: elevation
condition: []
action:
- if:
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
above: !input sunrise_offset
then:
- service: input_select.select_option
data:
option: Day
target:
entity_id: !input input_select_day_night
else:
- if:
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
below: !input sunset_offset
then:
- service: input_select.select_option
data:
option: Night
target:
entity_id: !input input_select_day_night
mode: single
Updated to use sun’s elevation