Hello Everyone!
I’ve been using the Alarm Clock made by @hokagegano for quite some time now and love it but I wanted something that made use of the Actionable Notifications for the iOS App so I added a few things to it and thought I would share it with the rest of you who have iOS.
First download and set up the iOS App.
Then add these lines in the appropriate places depending on how you organize your .yaml files.
configuration.yaml
ios:
push:
categories:
- name: alarm clock
identifier: 'alarmclock'
actions:
- identifier: 'AWAKE'
title: 'Awake'
destructive: no
- identifier: 'SNOOZE'
title: 'Snooze'
destructive: yes
input_boolean.yaml
alarm_clock_status:
initial: on
input_number.yaml
alarm_clock_hour:
name: Hour
icon: mdi:timer
initial: 12
min: 0
max: 23
step: 1
mode: slider
alarm_clock_minutes:
name: Minutes
icon: mdi:timer
initial: 0
min: 0
max: 55
step: 5
mode: slider
sensors.yaml
platform: template
sensors:
alarm_clock_hour:
value_template: '{{ states.input_number.alarm_clock_hour.state | int }}'
alarm_clock_minutes:
value_template: '{{ states.input_number.alarm_clock_minutes.state | int }}'
alarm_clock_time:
value_template: >-
{{ states.sensor.alarm_clock_hour.state }}:
{%- if states.sensor.alarm_clock_minutes.state|length == 1 -%}
0
{%- endif -%}
{{ states.sensor.alarm_clock_minutes.state }}
alarm_clock_time_long:
value_template: >-
{% if states.sensor.alarm_clock_hour.state|length == 1 -%}
0
{%- endif -%}
{{ states.sensor.alarm_clock_hour.state }}:
{%- if states.sensor.alarm_clock_minutes.state|length == 1 -%}
0
{%- endif -%}
{{ states.sensor.alarm_clock_minutes.state }}
groups.yaml
alarm_clock:
name: Alarm Clock
entities:
- sensor.alarm_clock_time
- input_number.alarm_clock_hour
- input_number.alarm_clock_minutes
- input_boolean.alarm_clock_status
automation.yaml
###### automation for turning on the alarm ######
id: alarm_clock_activated
alias: Alarm Clock Activated
hide_entity: False
trigger:
platform: template
value_template: '{{ states.sensor.time.state == states.sensor.alarm_clock_time_long.state }}'
condition:
condition: state
entity_id: input_boolean.alarm_clock_status
state: 'on'
action:
- service: script.turn_on
entity_id: script.s_alarm_clock_wake_up
- service: notify.ios_3vasi0ns_iphone
data:
title: "Alarm Clock"
message: "It's Time For You To Wake Up!"
data:
push:
sound: "US-EN-Alexa-Good-Morning.wav"
badge: 0
category: 'alarmclock'
###### awake actionable notification pushed ######
id: a_alarm_clock_awake_action
alias: alarm clock awake action
initial_state: true
hide_entity: true
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: AWAKE
action:
service: script.turn_on
entity_id: script.s_alarm_clock_awake
###### snooze actionable notification pushed ######
id: a_alarm_clock_snooze_action
alias: alarm clock snooze action
initial_state: true
hide_entity: true
trigger:
platform: event
event_type: ios.notification_action_fired
event_data:
actionName: SNOOZE
action:
service: script.turn_on
entity_id: script.s_alarm_clock_snooze
scripts.yaml
###### script for running what happens after awake button is pushed ######
s_alarm_clock_awake:
sequence:
- delay: '00:15:00'
- service: light.lifx_set_state
data:
entity_id: light.left_end_table_lamp
power: false
transition: '5'
- service: light.lifx_set_state
data:
entity_id: light.right_end_table_lamp
power: false
transition: '5'
###### script for running what happens when snooze button is pushed and for turning on the snooze timer and turning off lights ######
s_alarm_clock_snooze:
sequence:
- service: script.turn_off
data:
entity_id: script.s_alarm_clock_snooze_timer
- service: light.lifx_set_state
data:
entity_id: light.left_end_table_lamp
power: false
transition: '5'
- service: light.lifx_set_state
data:
entity_id: light.right_end_table_lamp
power: false
transition: '5'
- service: script.turn_on
data:
entity_id: script.s_alarm_clock_snooze_timer
###### script for the snooze timer ######
s_alarm_clock_snooze_timer:
sequence:
- delay:
minutes: 5
- service: automation.trigger
data:
entity_id: automation.alarm_clock_activated
###### script for running what happens when the alarm clock gets turned on ######
s_alarm_clock_wake_up:
sequence:
- service: light.lifx_set_state
data:
entity_id: light.left_end_table_lamp
brightness: 255
color_name: white
power: true
transition: 10
- service: light.lifx_set_state
data:
entity_id: light.right_end_table_lamp
brightness: 255
color_name: white
power: true
transition: 10
If you need any help just ask. I’d be more than happy to do the best I can.
If you have any suggestions or tips that would be awesome and I’d love to hear it!