Fix notification reset on Tony's Med Tracker
This commit is contained in:
138
automations.yaml
138
automations.yaml
@ -2308,46 +2308,45 @@
|
|||||||
- id: '1696288846954'
|
- id: '1696288846954'
|
||||||
alias: Tony Meds Handler
|
alias: Tony Meds Handler
|
||||||
description: Handles the scheduling of medication reminders for Tony
|
description: Handles the scheduling of medication reminders for Tony
|
||||||
trigger:
|
triggers:
|
||||||
- platform: time_pattern
|
- minutes: /30
|
||||||
minutes: /30
|
|
||||||
id: trigger30
|
id: trigger30
|
||||||
alias: Every 30 minutes
|
alias: Every 30 minutes
|
||||||
- platform: time
|
trigger: time_pattern
|
||||||
at: input_datetime.tony_morning_meds_notify
|
- at: input_datetime.tony_morning_meds_notify
|
||||||
id: morning-notify
|
id: morning-notify
|
||||||
alias: Morning Notify
|
alias: Morning Notify
|
||||||
- platform: time
|
trigger: time
|
||||||
at: input_datetime.tony_afternoon_meds_notify
|
- at: input_datetime.tony_afternoon_meds_notify
|
||||||
id: afternoon-notify
|
id: afternoon-notify
|
||||||
alias: Afternoon Notify
|
alias: Afternoon Notify
|
||||||
- platform: time
|
trigger: time
|
||||||
at: input_datetime.tony_night_meds_notify
|
- at: input_datetime.tony_night_meds_notify
|
||||||
id: night-notify
|
id: night-notify
|
||||||
alias: Night Notify
|
alias: Night Notify
|
||||||
- platform: state
|
trigger: time
|
||||||
entity_id:
|
- entity_id:
|
||||||
- input_boolean.tony_morning_meds_taken
|
- input_boolean.tony_morning_meds_taken
|
||||||
to: 'on'
|
to: 'on'
|
||||||
id: boolean-morning
|
id: boolean-morning
|
||||||
alias: Morning Taken
|
alias: Morning Taken
|
||||||
from: 'off'
|
from: 'off'
|
||||||
- platform: state
|
trigger: state
|
||||||
entity_id:
|
- entity_id:
|
||||||
- input_boolean.tony_afternoon_meds_taken
|
- input_boolean.tony_afternoon_meds_taken
|
||||||
id: boolean-afternoon
|
id: boolean-afternoon
|
||||||
from: 'off'
|
from: 'off'
|
||||||
to: 'on'
|
to: 'on'
|
||||||
alias: Afternoon Taken
|
alias: Afternoon Taken
|
||||||
- platform: state
|
trigger: state
|
||||||
entity_id:
|
- entity_id:
|
||||||
- input_boolean.tony_night_meds_taken
|
- input_boolean.tony_night_meds_taken
|
||||||
id: boolean-night
|
id: boolean-night
|
||||||
alias: Night Taken
|
alias: Night Taken
|
||||||
from: 'off'
|
from: 'off'
|
||||||
to: 'on'
|
to: 'on'
|
||||||
- platform: event
|
trigger: state
|
||||||
event_type: wakeup_event
|
- event_type: wakeup_event
|
||||||
event_data:
|
event_data:
|
||||||
who: tony
|
who: tony
|
||||||
type: wakeup
|
type: wakeup
|
||||||
@ -2356,8 +2355,8 @@
|
|||||||
- c3909d27048140729f002aaef0391775
|
- c3909d27048140729f002aaef0391775
|
||||||
alias: Wakeup
|
alias: Wakeup
|
||||||
id: wakeup
|
id: wakeup
|
||||||
- platform: event
|
trigger: event
|
||||||
event_type: ios.action_fired
|
- event_type: ios.action_fired
|
||||||
id: manual-wakeup
|
id: manual-wakeup
|
||||||
event_data:
|
event_data:
|
||||||
actionName: Manual Wakeup
|
actionName: Manual Wakeup
|
||||||
@ -2365,14 +2364,15 @@
|
|||||||
user_id:
|
user_id:
|
||||||
- c3909d27048140729f002aaef0391775
|
- c3909d27048140729f002aaef0391775
|
||||||
alias: Manual Wakeup
|
alias: Manual Wakeup
|
||||||
- platform: state
|
trigger: event
|
||||||
entity_id:
|
- entity_id:
|
||||||
- input_number.tony_afternoon_meds_interval
|
- input_number.tony_afternoon_meds_interval
|
||||||
- input_datetime.tony_morning_meds_taken
|
- input_datetime.tony_morning_meds_taken
|
||||||
alias: Afternoon Update
|
alias: Afternoon Update
|
||||||
id: afternoon-update
|
id: afternoon-update
|
||||||
condition: []
|
trigger: state
|
||||||
action:
|
conditions: []
|
||||||
|
actions:
|
||||||
- alias: Routing
|
- alias: Routing
|
||||||
choose:
|
choose:
|
||||||
- conditions:
|
- conditions:
|
||||||
@ -2387,10 +2387,10 @@
|
|||||||
state: 'on'
|
state: 'on'
|
||||||
alias: Morning meds reminder needed
|
alias: Morning meds reminder needed
|
||||||
then:
|
then:
|
||||||
- service: script.tony_morning_meds
|
- metadata: {}
|
||||||
metadata: {}
|
|
||||||
data: {}
|
data: {}
|
||||||
alias: Run morning meds notification script
|
alias: Run morning meds notification script
|
||||||
|
action: script.tony_morning_meds
|
||||||
- alias: Check afternoon reminder switch
|
- alias: Check afternoon reminder switch
|
||||||
if:
|
if:
|
||||||
- alias: Afternoon meds reminder needed
|
- alias: Afternoon meds reminder needed
|
||||||
@ -2399,8 +2399,8 @@
|
|||||||
state: 'on'
|
state: 'on'
|
||||||
then:
|
then:
|
||||||
- alias: Run afternoon meds notification script
|
- alias: Run afternoon meds notification script
|
||||||
service: script.tony_afternoon_meds
|
|
||||||
data: {}
|
data: {}
|
||||||
|
action: script.tony_afternoon_meds
|
||||||
- alias: Check night reminder switch
|
- alias: Check night reminder switch
|
||||||
if:
|
if:
|
||||||
- condition: state
|
- condition: state
|
||||||
@ -2408,10 +2408,10 @@
|
|||||||
state: 'on'
|
state: 'on'
|
||||||
alias: Night meds reminder needed
|
alias: Night meds reminder needed
|
||||||
then:
|
then:
|
||||||
- service: script.tony_night_meds
|
- metadata: {}
|
||||||
metadata: {}
|
|
||||||
data: {}
|
data: {}
|
||||||
alias: Run night meds notification script
|
alias: Run night meds notification script
|
||||||
|
action: script.tony_night_meds
|
||||||
alias: Every 30 minutes
|
alias: Every 30 minutes
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: and
|
- condition: and
|
||||||
@ -2423,16 +2423,16 @@
|
|||||||
state: 'off'
|
state: 'off'
|
||||||
alias: Morning Notify
|
alias: Morning Notify
|
||||||
sequence:
|
sequence:
|
||||||
- service: input_boolean.turn_on
|
- metadata: {}
|
||||||
metadata: {}
|
|
||||||
data: {}
|
data: {}
|
||||||
target:
|
target:
|
||||||
entity_id: input_boolean.tony_morning_meds_reminder
|
entity_id: input_boolean.tony_morning_meds_reminder
|
||||||
alias: Activate morning reminders
|
alias: Activate morning reminders
|
||||||
- service: script.tony_morning_meds
|
action: input_boolean.turn_on
|
||||||
metadata: {}
|
- metadata: {}
|
||||||
data: {}
|
data: {}
|
||||||
alias: Run morning meds notification script
|
alias: Run morning meds notification script
|
||||||
|
action: script.tony_morning_meds
|
||||||
- conditions:
|
- conditions:
|
||||||
- alias: Afternoon Notify
|
- alias: Afternoon Notify
|
||||||
condition: and
|
condition: and
|
||||||
@ -2445,14 +2445,14 @@
|
|||||||
state: 'off'
|
state: 'off'
|
||||||
sequence:
|
sequence:
|
||||||
- alias: Activate afternoon reminders
|
- alias: Activate afternoon reminders
|
||||||
service: input_boolean.turn_on
|
|
||||||
metadata: {}
|
metadata: {}
|
||||||
data: {}
|
data: {}
|
||||||
target:
|
target:
|
||||||
entity_id: input_boolean.tony_afternoon_meds_reminder
|
entity_id: input_boolean.tony_afternoon_meds_reminder
|
||||||
|
action: input_boolean.turn_on
|
||||||
- alias: Run afternoon meds notification script
|
- alias: Run afternoon meds notification script
|
||||||
service: script.tony_afternoon_meds
|
|
||||||
data: {}
|
data: {}
|
||||||
|
action: script.tony_afternoon_meds
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: and
|
- condition: and
|
||||||
conditions:
|
conditions:
|
||||||
@ -2465,22 +2465,21 @@
|
|||||||
alias: Night Notify
|
alias: Night Notify
|
||||||
sequence:
|
sequence:
|
||||||
- alias: Activate night reminders
|
- alias: Activate night reminders
|
||||||
service: input_boolean.turn_on
|
|
||||||
metadata: {}
|
metadata: {}
|
||||||
data: {}
|
data: {}
|
||||||
target:
|
target:
|
||||||
entity_id: input_boolean.tony_night_meds_reminder
|
entity_id: input_boolean.tony_night_meds_reminder
|
||||||
- service: script.tony_night_meds
|
action: input_boolean.turn_on
|
||||||
metadata: {}
|
- metadata: {}
|
||||||
data: {}
|
data: {}
|
||||||
alias: Run night meds notification script
|
alias: Run night meds notification script
|
||||||
|
action: script.tony_night_meds
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id: boolean-morning
|
id: boolean-morning
|
||||||
alias: Morning Taken
|
alias: Morning Taken
|
||||||
sequence:
|
sequence:
|
||||||
- service: input_datetime.set_datetime
|
- target:
|
||||||
target:
|
|
||||||
entity_id: input_datetime.tony_morning_meds_taken
|
entity_id: input_datetime.tony_morning_meds_taken
|
||||||
data:
|
data:
|
||||||
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0)
|
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0)
|
||||||
@ -2488,28 +2487,28 @@
|
|||||||
|
|
||||||
'
|
'
|
||||||
alias: Set time morning meds were taken
|
alias: Set time morning meds were taken
|
||||||
- service: input_boolean.turn_off
|
action: input_datetime.set_datetime
|
||||||
metadata: {}
|
- metadata: {}
|
||||||
data: {}
|
data: {}
|
||||||
target:
|
target:
|
||||||
entity_id: input_boolean.tony_morning_meds_reminder
|
entity_id: input_boolean.tony_morning_meds_reminder
|
||||||
alias: Deactivate morning reminders
|
alias: Deactivate morning reminders
|
||||||
- service: script.text_notify
|
action: input_boolean.turn_off
|
||||||
metadata: {}
|
- metadata: {}
|
||||||
data:
|
data:
|
||||||
type: alert
|
type: alert
|
||||||
who: tony
|
who: tony
|
||||||
message: clear_notification
|
message: clear_notification
|
||||||
tag: tony-left-meds
|
tag: tony-left-meds
|
||||||
alias: Clear tony-left-meds notification tag
|
alias: Clear tony-left-meds notification tag
|
||||||
|
action: script.text_notify
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id:
|
id:
|
||||||
- boolean-afternoon
|
- boolean-afternoon
|
||||||
alias: Afternoon Taken
|
alias: Afternoon Taken
|
||||||
sequence:
|
sequence:
|
||||||
- service: input_datetime.set_datetime
|
- target:
|
||||||
target:
|
|
||||||
entity_id: input_datetime.tony_afternoon_meds_taken
|
entity_id: input_datetime.tony_afternoon_meds_taken
|
||||||
data:
|
data:
|
||||||
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0)
|
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0)
|
||||||
@ -2517,27 +2516,27 @@
|
|||||||
|
|
||||||
'
|
'
|
||||||
alias: Set time afternoon meds were taken
|
alias: Set time afternoon meds were taken
|
||||||
|
action: input_datetime.set_datetime
|
||||||
- alias: Deactivate afternoon reminders
|
- alias: Deactivate afternoon reminders
|
||||||
service: input_boolean.turn_off
|
|
||||||
metadata: {}
|
metadata: {}
|
||||||
data: {}
|
data: {}
|
||||||
target:
|
target:
|
||||||
entity_id: input_boolean.tony_afternoon_meds_reminder
|
entity_id: input_boolean.tony_afternoon_meds_reminder
|
||||||
- service: script.text_notify
|
action: input_boolean.turn_off
|
||||||
metadata: {}
|
- metadata: {}
|
||||||
data:
|
data:
|
||||||
type: alert
|
type: alert
|
||||||
who: tony
|
who: tony
|
||||||
message: clear_notification
|
message: clear_notification
|
||||||
tag: tony-left-meds
|
tag: tony-left-meds
|
||||||
alias: Clear tony-left-meds notification tag
|
alias: Clear tony-left-meds notification tag
|
||||||
|
action: script.text_notify
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id: boolean-night
|
id: boolean-night
|
||||||
alias: Night Taken
|
alias: Night Taken
|
||||||
sequence:
|
sequence:
|
||||||
- service: input_datetime.set_datetime
|
- target:
|
||||||
target:
|
|
||||||
entity_id: input_datetime.tony_night_meds_taken
|
entity_id: input_datetime.tony_night_meds_taken
|
||||||
data:
|
data:
|
||||||
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0)
|
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0)
|
||||||
@ -2545,20 +2544,21 @@
|
|||||||
|
|
||||||
'
|
'
|
||||||
alias: Set time night meds were taken
|
alias: Set time night meds were taken
|
||||||
|
action: input_datetime.set_datetime
|
||||||
- alias: Deactivate night reminders
|
- alias: Deactivate night reminders
|
||||||
service: input_boolean.turn_off
|
|
||||||
metadata: {}
|
metadata: {}
|
||||||
data: {}
|
data: {}
|
||||||
target:
|
target:
|
||||||
entity_id: input_boolean.tony_night_meds_reminder
|
entity_id: input_boolean.tony_night_meds_reminder
|
||||||
- service: script.text_notify
|
action: input_boolean.turn_off
|
||||||
metadata: {}
|
- metadata: {}
|
||||||
data:
|
data:
|
||||||
type: alert
|
type: alert
|
||||||
who: tony
|
who: tony
|
||||||
message: clear_notification
|
message: clear_notification
|
||||||
tag: tony-left-meds
|
tag: tony-left-meds
|
||||||
alias: Clear tony-left-meds notification tag
|
alias: Clear tony-left-meds notification tag
|
||||||
|
action: script.text_notify
|
||||||
- conditions:
|
- conditions:
|
||||||
- alias: Wakeup
|
- alias: Wakeup
|
||||||
condition: trigger
|
condition: trigger
|
||||||
@ -2566,8 +2566,7 @@
|
|||||||
- wakeup
|
- wakeup
|
||||||
- manual-wakeup
|
- manual-wakeup
|
||||||
sequence:
|
sequence:
|
||||||
- service: input_datetime.set_datetime
|
- target:
|
||||||
target:
|
|
||||||
entity_id: input_datetime.tony_morning_meds_notify
|
entity_id: input_datetime.tony_morning_meds_notify
|
||||||
data:
|
data:
|
||||||
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,1)
|
datetime: '{% from ''time.jinja'' import set_datetime %} {{ set_datetime(0,1)
|
||||||
@ -2575,8 +2574,8 @@
|
|||||||
|
|
||||||
'
|
'
|
||||||
alias: Set time to start notifying for morning meds
|
alias: Set time to start notifying for morning meds
|
||||||
- service: input_datetime.set_datetime
|
action: input_datetime.set_datetime
|
||||||
target:
|
- target:
|
||||||
entity_id: input_datetime.tony_afternoon_meds_notify
|
entity_id: input_datetime.tony_afternoon_meds_notify
|
||||||
data:
|
data:
|
||||||
datetime: '{% from ''time.jinja'' import set_datetime %} {% set morning
|
datetime: '{% from ''time.jinja'' import set_datetime %} {% set morning
|
||||||
@ -2587,8 +2586,8 @@
|
|||||||
|
|
||||||
'
|
'
|
||||||
alias: Set time to start notifying for afternoon meds
|
alias: Set time to start notifying for afternoon meds
|
||||||
- service: input_datetime.set_datetime
|
action: input_datetime.set_datetime
|
||||||
target:
|
- target:
|
||||||
entity_id: input_datetime.tony_night_meds_notify
|
entity_id: input_datetime.tony_night_meds_notify
|
||||||
data:
|
data:
|
||||||
date: '{% from ''time.jinja'' import set_datetime %} {% set current = as_timestamp(now())
|
date: '{% from ''time.jinja'' import set_datetime %} {% set current = as_timestamp(now())
|
||||||
@ -2598,8 +2597,8 @@
|
|||||||
'
|
'
|
||||||
time: 04:00:00
|
time: 04:00:00
|
||||||
alias: Set time to start notifying for night meds
|
alias: Set time to start notifying for night meds
|
||||||
- alias: Turn off all meds taken
|
action: input_datetime.set_datetime
|
||||||
service: input_boolean.turn_off
|
- alias: Turn off all meds booleans
|
||||||
metadata: {}
|
metadata: {}
|
||||||
data: {}
|
data: {}
|
||||||
target:
|
target:
|
||||||
@ -2607,23 +2606,17 @@
|
|||||||
- input_boolean.tony_morning_meds_taken
|
- input_boolean.tony_morning_meds_taken
|
||||||
- input_boolean.tony_afternoon_meds_taken
|
- input_boolean.tony_afternoon_meds_taken
|
||||||
- input_boolean.tony_night_meds_taken
|
- input_boolean.tony_night_meds_taken
|
||||||
- service: counter.reset
|
- input_boolean.tony_morning_meds_reminder
|
||||||
metadata: {}
|
- input_boolean.tony_afternoon_meds_reminder
|
||||||
data: {}
|
- input_boolean.tony_night_meds_reminder
|
||||||
target:
|
action: input_boolean.turn_off
|
||||||
entity_id:
|
|
||||||
- counter.tony_morning_meds_reminder_count
|
|
||||||
- counter.tony_afternoon_meds_reminder_count
|
|
||||||
- counter.tony_night_meds_reminder_count
|
|
||||||
alias: Reset all reminder counters
|
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id:
|
id:
|
||||||
- afternoon-update
|
- afternoon-update
|
||||||
alias: Afternoon Update
|
alias: Afternoon Update
|
||||||
sequence:
|
sequence:
|
||||||
- service: input_datetime.set_datetime
|
- target:
|
||||||
target:
|
|
||||||
entity_id: input_datetime.tony_afternoon_meds_notify
|
entity_id: input_datetime.tony_afternoon_meds_notify
|
||||||
data:
|
data:
|
||||||
datetime: '{% from ''time.jinja'' import set_datetime %} {% set morning
|
datetime: '{% from ''time.jinja'' import set_datetime %} {% set morning
|
||||||
@ -2634,6 +2627,7 @@
|
|||||||
|
|
||||||
'
|
'
|
||||||
alias: Update notification
|
alias: Update notification
|
||||||
|
action: input_datetime.set_datetime
|
||||||
mode: parallel
|
mode: parallel
|
||||||
max: 12
|
max: 12
|
||||||
- id: '1696288939707'
|
- id: '1696288939707'
|
||||||
|
Reference in New Issue
Block a user