|
|
@@ -0,0 +1,93 @@
|
|
|
+sensor:
|
|
|
+ - platform: template
|
|
|
+ sensors:
|
|
|
+ wakeup_start_time_lights:
|
|
|
+ friendly_name: 'Start time'
|
|
|
+ value_template: >
|
|
|
+ {% set starttime = states.input_datetime.wakeup_alarm_time.attributes.timestamp - (states.input_number.wakeup_duration.state | int) * 60 %}
|
|
|
+ {{ starttime | timestamp_custom('%H:%M', False) }}
|
|
|
+ icon_template: 'mdi:clock-start'
|
|
|
+
|
|
|
+input_boolean:
|
|
|
+ wakeup:
|
|
|
+ name: 'Wakeup light'
|
|
|
+ icon: mdi:power
|
|
|
+ initial: off
|
|
|
+ wakeup_weekends:
|
|
|
+ name: 'Wakeup Weekend'
|
|
|
+ icon: mdi:calendar-clock
|
|
|
+ initial: off
|
|
|
+
|
|
|
+input_number:
|
|
|
+ wakeup_duration:
|
|
|
+ name: Dauer
|
|
|
+ icon: mdi:clock-in
|
|
|
+ initial: 20
|
|
|
+ min: 5
|
|
|
+ max: 60
|
|
|
+ step: 5
|
|
|
+ unit_of_measurement: 'min'
|
|
|
+
|
|
|
+input_datetime:
|
|
|
+ wakeup_alarm_time:
|
|
|
+ name: 'Alarm time'
|
|
|
+ #icon: mdi:clock-end
|
|
|
+ has_date: false
|
|
|
+ has_time: true
|
|
|
+ initial: '06:30'
|
|
|
+
|
|
|
+
|
|
|
+group:
|
|
|
+ wakeuplight:
|
|
|
+ name: Wakeup Light
|
|
|
+ control: hidden
|
|
|
+ entities:
|
|
|
+ - input_datetime.wakeup_alarm_time
|
|
|
+ - input_number.wakeup_duration
|
|
|
+ - sensor.wakeup_start_time_lights
|
|
|
+ - input_boolean.wakeup
|
|
|
+ - input_boolean.wakeup_weekends
|
|
|
+
|
|
|
+automation:
|
|
|
+ - action:
|
|
|
+ - service: script.wakeup_bedroom
|
|
|
+ alias: 'Wakeup Bedroom'
|
|
|
+ hide_entity: true
|
|
|
+ condition:
|
|
|
+ condition: and
|
|
|
+ conditions:
|
|
|
+ - condition: state
|
|
|
+ entity_id: input_boolean.wakeup
|
|
|
+ state: 'on'
|
|
|
+ - condition: or
|
|
|
+ conditions:
|
|
|
+ - condition: state
|
|
|
+ entity_id: input_boolean.wakeup_weekends
|
|
|
+ state: 'on'
|
|
|
+ - condition: time
|
|
|
+ weekday:
|
|
|
+ - mon
|
|
|
+ - tue
|
|
|
+ - wed
|
|
|
+ - thu
|
|
|
+ - fri
|
|
|
+ trigger:
|
|
|
+ platform: template
|
|
|
+ value_template: '{{ states.sensor.time.state == states.sensor.wakeup_start_time_lights.state }}'
|
|
|
+
|
|
|
+script:
|
|
|
+ wakeup_bedroom:
|
|
|
+ alias: 'Wakeup Light'
|
|
|
+ sequence:
|
|
|
+ - service: light.turn_on
|
|
|
+ data_template:
|
|
|
+ entity_id: light.bedroom
|
|
|
+ brightness: 1
|
|
|
+ xy_color: [0.5016, 0.4151]
|
|
|
+ - delay:
|
|
|
+ seconds: 1
|
|
|
+ - service: light.turn_on
|
|
|
+ data_template:
|
|
|
+ entity_id: light.bedroom
|
|
|
+ brightness: 255
|
|
|
+ transition: '{{ states.input_number.wakeup_duration.state | multiply(60) | int }}'
|