home-assistant/packages/sunrise.yaml

162 lines
4.0 KiB
YAML

scene:
- name: Dawn Sun
entities:
light.bedroom_lamp:
state: on
brightness: 1
xy_color: [0.6042, 0.3739]
light.shelf_lamp:
state: on
brightness: 1
xy_color: [0.6042, 0.3739]
- name: Dawn Daylight
entities:
light.correls_nightstand:
state: on
brightness: 1
xy_color: [0.2376, 0.1186]
light.stephanies_nightstand:
state: on
brightness: 1
xy_color: [0.2376, 0.1186]
- name: Sunrise Sun
entities:
light.bedroom_lamp:
state: on
transition: 1800
brightness: 254
xy_color: [0.3769, 0.3639]
light.shelf_lamp:
state: on
transition: 1800
brightness: 254
xy_color: [0.3769, 0.3639]
- name: Sunrise Daylight
entities:
light.correls_nightstand:
state: on
transition: 1800
brightness: 203
xy_color: [0.2698, 0.295]
light.stephanies_nightstand:
state: on
transition: 1800
brightness: 203
xy_color: [0.2698, 0.295]
script:
sunrise:
alias: Sunrise
sequence:
- service: scene.turn_on
data:
entity_id: scene.dawn_sun
- service: scene.turn_on
data:
entity_id: scene.sunrise_sun
- delay:
seconds: 180
- service: scene.turn_on
data:
entity_id: scene.dawn_daylight
- service: scene.turn_on
data:
entity_id: scene.sunrise_daylight
input_select:
sunrise_days:
name: Days to wake up
options:
- Every Day
- Weekdays
icon: mdi:weather-sunset
input_datetime:
sunrise_latest_time:
name: Latest start time
has_date: false
has_time: true
initial: '07:30'
sunrise_earliest_time:
name: Earliest start time
has_date: false
has_time: true
initial: '06:30'
sensor:
- platform: time_date
display_options:
- time
automation:
- alias: Sunrise
action:
- service: script.sunrise
data: {}
trigger:
- platform: sun
event: sunrise
offset: '-00:30:00'
- platform: template
value_template: >-
{{ states('sensor.time') == (
states.input_datetime.sunrise_earliest_time.attributes.timestamp
| int | timestamp_custom('%H:%M', False)
)
}}
- platform: template
value_template: >-
{{ states('sensor.time') == (
states.input_datetime.sunrise_latest_time.attributes.timestamp
| int | timestamp_custom('%H:%M', False)
)
}}
condition:
- condition: state
entity_id: binary_sensor.occupied
state: 'on'
- condition: state
entity_id: group.bedroom_lights
state: 'off'
- condition: and
conditions:
- condition: time
after: input_datetime.sunrise_earliest_time
- condition: sun
after: sunrise
after_offset: '-00:30:00'
- condition: or
conditions:
- condition: state
entity_id: input_select.sunrise_days
state: Every Day
- condition: and
conditions:
- condition: state
entity_id: input_select.sunrise_days
state: Weekdays
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
group:
sunrise_scenes:
name: scenes
entities:
- scene.dawn_sun
- scene.dawn_daylight
- scene.sunrise_sun
- scene.sunrise_daylight
sunrise_automations:
name: Automations
entities:
- automation.sunrise
sunrise_options:
name: Options
entities:
- input_select.sunrise_days
- input_datetime.sunrise_earliest_time
- input_datetime.sunrise_latest_time
sunrise_scripts:
name: Scripts
entities:
- script.sunrise