Not sure why you’re getting that first error as I don’t recieve it on the adapted automation below. You were missing a ' in the value_template: which has causing the second error. The timeout is added after the wait_template. You need to decide how long you want to wait for the alarm to stop snoozing.
Also from what I’ve read, the Google Home Integrationuses polling to gather the alarms status which defaults to 180 seconds. So there maybe a delay in to the action > wait_template of up to 3 minutes before the actions are then run.
If you’re continuning to have errors, I think it may be better to break out your code into a seperate thread where more people will see it. As this thread’s original question has been marked as solved.
##########################
## Google Home alarms
##########################
- id: 'Google Home alarm' #NOTE: Use a unique ID here i.e. 2314ffe5-2995-44e1-8a23-df4ce5c4cba7
alias: 'GH Alarm trigger'
trigger:
- platform: template #Trigger if the current / time date is the same as the current alarm time.
value_template: "{{ as_timestamp(now()) == as_timestamp(states('sensor.woonkamer_mini_alarms')) }}"
condition: []
action:
- alias: "Wait until the alarm status isn't snoozed"
wait_template: "{{ not is_state_attr('sensor.woonkamer_mini_alarms', 'alarms[0].status', 'snoozed') }}"
timeout: "00:01:00" #NOTE: change this timeout for how long you're willing to wait for the alarm to stop snoozing.
continue_on_timeout: false #NOTE: The automation won't continue once the above wait_template has timed out.
- entity_id: light.kastlamp
service: light.turn_on
mode: single
I dont get anymore errors, so thats good
However, just tested with an alarm
I didnt snooze, and just stopped the alarm, but no light went on
Will see to start topic i guess
As I said, the automation needs some testing. I’d suggest you monitor the alarm sensor using a template in the Devloper Tools. {{ state_attr('sensor.woonkamer_mini_alarms', 'alarms[0].status') }}. Setup your alarm and see how this state changes as you run through the alarm ringing, snoozing and being turned off. This should help you identify which states the alarm status goes through in a typical use.
You could try using a wait_trigger instead of a wait_template The latter lets you specificy a to and from for the wait_trigger so might give you more control that you’re after.
Note: I think your requirements of the Google Home integration might be greater than the features of the integration so it maybe difficult to impliment the automation as seamlessly as you like. It looks like the GH integration uses polling to update each sensor, instead of updating each sensor when it’s state changes. The default/recommended polling is 180 seconds. So it’s possible that the alarm could go from being set to ringing to snoozed or back to none or set for the next alarm all in the space of 180s. In which case the follow of the automation wouldn’t get triggered as you are expecting. You can change the polling rate in the integration but it’s been reported that anything less than 180s can cause errors or the integration to break.
First off, i made a new topic, so maybe reply there…
You are right that the polling will cause issues…
Its just too slow.
Perhaps its better to make an automation that starts at the day and time set in the alarm?
Or how would you do it?
You can answer in the new thread cause nobody replying there
Perhaps its better to make an automation that starts at the day and time set in the alarm?
Others have posted in this thread, how to create what you’re seeking to do.
The polling issue isn’t likely to effect the above. Where it’s likely to cause an issue is asssing what state the alarm is in your wakeup flow. I.e. snoozing, rining, finished, etc. As those events can happen quite quickly or too quickly for the polling to detect. That’s where you’ll have issues. It’s for this reason I abandoned his automation and used a PIR in a spefic room to wait for an event, and then triggered my morning routine.
ok thx
anyway, i changed automation now like this and it works
Will see if thats sufficient
- id: 'Google Home alarm mister X'
alias: 'GH Alarm trigger mister x'
trigger:
- platform: template #Trigger if the current / time date is the same as the current alarm time.
value_template: "{{ now() >= states('sensor.slaapkamer_alarms')|as_datetime }}"
condition: []
action:
#Do you actions / sripts
- delay: 00:00:04
- service: tts.cloud_say
data:
entity_id: media_player.slaapkamer
message: "Goeiemorgen ! Tijd om rustig op te staan."
language: nl-NL
options:
gender: male
- delay: 00:00:03
- service: media_player.turn_off
data:
entity_id: media_player.slaapkamer
- entity_id: light.lavabo
service: light.turn_on
mode: single