diff --git a/automations/files/alarm-clock.yaml b/automations/files/alarm-clock.yaml index 31af243..a96d7c4 100644 --- a/automations/files/alarm-clock.yaml +++ b/automations/files/alarm-clock.yaml @@ -1,17 +1,9 @@ -- id: wakeup - alias: Wakeup automation +- id: alarm-automation + alias: [Alarm] Wakeup automation description: '' trigger: - platform: time at: input_datetime.alarm - condition: - - condition: time - weekday: - - mon - - tue - - wed - - thu - - fri action: - service: light.turn_on data: @@ -28,7 +20,7 @@ entity_id: - light.bedroom_1 - light.bedroom_2 - - delay: '10' + - delay: '15' - service: media_player.volume_set data: volume_level: 0.1 @@ -43,10 +35,27 @@ media_content_id: media-source://media_source/local/wake-the-f-up-samurai-we-have-a-city-to-burn.mp3 media_content_type: music entity_id: media_player.bedroom_speaker - - delay: '10' + - delay: '15' - service: spotcast.start data: device_name: Bedroom speaker uri: 'spotify:playlist:71mXIu6HcdVj3fAMduaHop' random_song: true - mode: single \ No newline at end of file + mode: single +- id: alarm-update-time + alias: [Alarm] Update alarm time + mode: single + trigger: + - platform: state + entity_id: sensor.sm_g965f_next_alarm + condition: + - condition: not + conditions: + - condition: state + entity_id: sensor.sm_g965f_next_alarm + state: unknown + action: + - service: input_datetime.set_datetime + entity_id: input_datetime.alarm + data: + datetime: "{{ (((state_attr('sensor.sm_g965f_next_alarm', 'Time in Milliseconds') | int / 1000) - 30*60 ) | timestamp_custom('%Y-%m-%d %H:%M:%S')) }}"