Summary
- Ask Google Home/Google Assistant to turn off devices in X minutes (e.g: OK Google, turn off bedroom light in 5 minutes)
- Cancel current timer (e.g: OK Google, cancel bedroom light timer)
- New timer will override existing one
How does it work?
- Voice commands => Google Home/Google Assistant => IFTTT => Call Home Assistant scripts
Setup
HomeAssistant scripts:
- Main timer script: script to turn devices in X minutes
- Wrapper script: script to call to main script with logic of cancelling running script.
####### Main timer script
turn_off_bedroom_light_timer:
alias: ‘Timer to turn off bedroom light’
sequence:
- delay: ‘00:{{ time | int }}:00’
- service: light.turn_off
data:
entity_id: light.bedroom_light
####### Wrapper to startturn_off_bedroom_light_timer
with logic of cancel existing timer
turn_off_bedroom_light_timer_wrapper:
alias: ‘Timer to turn off bedroom light - wrapper’
sequence:
- service: script.turn_off
data:
entity_id: script.turn_off_bedroom_light_timer
- delay: ‘00:00:01’
- service: script.turn_off_bedroom_light_timer
data_template:
time: ‘{{ time | int }}’
Add IFTTT applets
Start timer applet
- Trigger: “Google Assistant - Say a phrase with a number”
- Action: Call to HomeAssistant API to turn on wrapper timer script
Cancel timer applet
- Trigger: “Google Assistant - Say a simple phrase”
- Action: Call to HomeAssistant API to turn off main timer script
Cheers