I’ve set up an input_select to pick from a short list of preset times, and put that into the “for” element of a state change. To me, the output looks exactly like it tells me it should look, but it clearly isnt! Here is my setup, and error in the log
2020-02-17 14:31:11 ERROR (MainThread) [homeassistant.components.automation.state] Error rendering 'Stop Spotify on Bedroom Echo' for template: offset minutes: '00:10:00' should be format 'HH:MM' or 'HH:MM:SS'
Any ideas would be greatly appreciated! I am sure its something simple but not being a programmer i struggle.
I would also recommend changing it from “00:{{ template }}:00” to
for:
minutes: "{{ states('input_select.snooze') | int }}"
I’m pretty sure the way you have it would be a supported template as well, but they don’t give that as an example specifically. I just think it’s easier to read and you’ll be able to support any number > 99 minutes. I know I sometimes want to snooze for 100 minutes and I’d be super sad to know I could only do 99 minutes lol.
Another thing,
trigger:
- entity_id: switch.snooze_timer
for: '00:{{ states('input_select.snooze') }}:00'
from: 'off'
platform: state
to: 'on'
condition:
- condition: state
entity_id: switch.snooze_timer
state: 'on'
Your condition here is 100% doing nothing. The trigger already required switch.snooze_timer to be ‘on’, so the condition will be met 100% of the time.
I think I know why you put it which would make sense as it’s what I thought happened as well. You probably assumed this would trigger as soon as switch.snooze_timer turned to ‘on’, then would wait for X minutes before continuing. In this case, it would be wise to check “did the switch turn off in that amount of time?”
In reality, this will only trigger once it’s been ‘on’ for X minutes. There is no waiting. So the condition “is the switch.snooze_timer on?” will 100% of the time be true and can be removed.
I’ve tried your suggestion (i had originally double quotes and it didn’t seem to like it)
i now get this error
2020-02-17 20:34:16 ERROR (MainThread) [homeassistant.components.automation.state] Error rendering 'Stop Spotify on Bedroom Echo' for template: offset minutes: "10" should be format 'HH:MM' or 'HH:MM:SS'
Essentially the same error but it seems to not like the double quotes… do i need to put quotes round my option in my input_select?
2020-02-17 20:51:17 ERROR (MainThread) [homeassistant.components.automation.state] Error rendering 'Stop Spotify on Bedroom Echo' for template: offset "00:10:00" should be format 'HH:MM' or 'HH:MM:SS'
which is why i went to the single quotation marks in the first place… not ideal but now you are seeing my frustration! I’ve tried the HH:MM option too
'00:{{ states('input_select.snooze') }}:00'
Yeah as Finity says it will see that as 2 strings - the quotes enclose each srting… That’s why you would use this instead: "00:{{ states('input_select.snooze') }}:00"
or '00:{{ states("input_select.snooze") }}:00'
OR you can even use 2 single quotes like this: '00:{{ states(''input_select.snooze'') }}:00'
The automation GUI editor loves double single quotes.
Thanks both, i have cut and paste from above and now get this error:
2020-02-18 08:58:05 ERROR (MainThread) [homeassistant.components.automation.state] Error rendering 'Stop Spotify on Bedroom Echo' for template: offset "00:10:00" should be format 'HH:MM' or 'HH:MM:SS'
As i said, this is why i dropped the swapped from double to single in the first place.
Could i have something else wrong?
Sorry, am away on business so limited testing. @VDRainer your solution seemed to work in the short time i had before leaving, I’m on latest release 0.105.5 and i think supervisor 201 / i updated yesterday.
I was using the front end tool but still putting in the double inverted commas, which is why i was getting the error, but not realising that was the cause!
I was in fact then applying double double inverted commas!