I have the following problem. I have garden lights which switches on at sunset. So far so good. I want these to have turned off normally at say 23:15 (11.15 PM). But sometimes (say I am off to a party and know to arrive late or staying late in the garden when the weather is good, my daughter is arriving late etc) I want to have these turned off at another time (say 00:15). Prefarably I want it by changing a lovelace interface item.
So My normal script is:
- id: '1579681705000'
alias: Buitenlicht uit om 23:15
description: Zet de lichtslang uit om 23:15
trigger:
- at: '23:15'
platform: time
condition:
- condition: state
entity_id: switch.stopcontact_buiten
state: 'on'
action:
- entity_id: switch.stopcontact_buiten
service: switch.turn_off
- entity_id: light.tuinlichtjes_light
service: light.turn_of
Now what I want is some input on my lovelace interface that preferably inputs time (like:
I have tried to replace the ‘23:15’ in the trigger with all kind of values but whatever I try it is not accepted as "good"code
I have tried to setup a time_patern and use inputs from this:
It is accepted as code but when reload automation it gives an int error.
For the time trigger I have tried this:
- at: '{{state_attr(''input_datetime.eindtijd_buitenlicht'',''hour'')|string}}:{{state_attr(''input_datetime.eindtijd_buitenlicht'',''hour'')|string}}'
and this:
- at: "{{states('input_datetime.eindtijd_buitenlicht')}}"
Based on an example I even tried something like this:
- at: '{{ as_timestamp(strptime((states(''input_datetime.eindtijd_buitenlicht'')), ''%H:%M'')) | timestamp_custom(''%H:%M'') }}'
No results
Then I switched to time_patern and tried:
trigger:
- hours: '{{states(''input_number.uren_timer'')|int}}'
minutes: '{{states(''input_number.minuten_timer'')|int}}'
platform: time_pattern
The code is checked ok bij HA but reloading HA gives this error:
invalid literal for int() with base 10: '{'
I think I am out of examples but I probably have tried more.
Is it the case that the At: of time cannot handle something else then fixed hardcoded times?
Any one an idea how to fix my problem? Maybe a complete other view on the actual problem (setting a time manually to a value for exceptions on the normal time schedule)
Max