Improve afternoon meds notification scheduling, close #180
This commit is contained in:
@ -2396,6 +2396,12 @@
|
|||||||
alias: Sleep Off
|
alias: Sleep Off
|
||||||
from: 'on'
|
from: 'on'
|
||||||
to: 'off'
|
to: 'off'
|
||||||
|
- platform: state
|
||||||
|
entity_id:
|
||||||
|
- input_number.tony_afternoon_meds_interval
|
||||||
|
- input_datetime.tony_morning_meds_taken
|
||||||
|
alias: Afternoon Update
|
||||||
|
id: afternoon-update
|
||||||
condition: []
|
condition: []
|
||||||
action:
|
action:
|
||||||
- alias: Routing
|
- alias: Routing
|
||||||
@ -2459,16 +2465,6 @@
|
|||||||
|
|
||||||
'
|
'
|
||||||
alias: Set time morning meds were taken
|
alias: Set time morning meds were taken
|
||||||
- service: input_datetime.set_datetime
|
|
||||||
target:
|
|
||||||
entity_id: input_datetime.tony_afternoon_meds_notify
|
|
||||||
data:
|
|
||||||
datetime: '{% from ''time.jinja'' import set_datetime %} {% set interval
|
|
||||||
= states(''input_number.tony_afternoon_meds_interval'') | int %} {{ set_datetime(interval)
|
|
||||||
}}
|
|
||||||
|
|
||||||
'
|
|
||||||
alias: Adjust afternoon meds reminder
|
|
||||||
- conditions:
|
- conditions:
|
||||||
- condition: trigger
|
- condition: trigger
|
||||||
id:
|
id:
|
||||||
@ -2512,6 +2508,23 @@
|
|||||||
|
|
||||||
'
|
'
|
||||||
alias: Set time to start notifying for morning meds
|
alias: Set time to start notifying for morning meds
|
||||||
|
- conditions:
|
||||||
|
- condition: trigger
|
||||||
|
id:
|
||||||
|
- afternoon-update
|
||||||
|
alias: Afternoon Update
|
||||||
|
sequence:
|
||||||
|
- service: input_datetime.set_datetime
|
||||||
|
target:
|
||||||
|
entity_id: input_datetime.tony_afternoon_meds_notify
|
||||||
|
data:
|
||||||
|
time: '{% from ''time.jinja'' import set_datetime %} {% set morning = state_attr(''input_datetime.tony_morning_meds_taken'',''timestamp'')
|
||||||
|
| int %} {% set interval = states(''input_number.tony_afternoon_meds_interval'')
|
||||||
|
| int %} {% set math = (interval * 60) * 60 %} {% set newtime = morning
|
||||||
|
+ math %} {{ newtime | timestamp_custom(''%H:%M'') }}
|
||||||
|
|
||||||
|
'
|
||||||
|
alias: Update notification
|
||||||
mode: parallel
|
mode: parallel
|
||||||
max: 10
|
max: 10
|
||||||
- id: '1696288939707'
|
- id: '1696288939707'
|
||||||
|
Reference in New Issue
Block a user