Hi
I want to setup two scripts which i will associate with a google home shortcut/routine.
The first script will store the current time / date and will happen when i feed the baby.
The second strip will tell me how long since the last feed.
Unfortunately this is well beyound my ability, however I’ve started things of as follows, and I’m hopeful that someone will fix it up for me.
input_text:
hours_since_last_feed:
name: Time since last feed
input_datetime:
last_feed:
name: "When Alex was last fed"
has_date: true
has_time: true
script:
set_last_feed:
sequence:
- service: input_datetime.set_datetime
entity_id: input_datetime.last_feed
data_template:
datetime: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}"
when_last_feed:
sequence:
# compare current time to input_datetime.set_datetime
# store result as input_text.hours_since_last_feed
# ????????????
# would be cool if it could round to say 2 hours / 2 and a quater / 2 and a half / 2 and three quaters.
- service: tts.google_translate_say
data_template:
message: "Alex was last fed {{states('input_text.hours_since_last_feed')}} hours ago."
cache: false