I changed the code from the link a bit by putting it all in a package (except for the scene; see below).
I don’t understand why 20:36 == 20:36 does not equal true, nor trigger the scene. The scene itself works, so I have not pasted the code here. When I manually call the scene, the light will act accordingly. Unlike the person in the post, I did use a scene instead of a script, because I could not get their script to work (even when copy/pasting the original code, the script would not show up with my other scripts, so I created a scene, which works).
Thank you! When I paste {{ states('sensor.time') == states('sensor.weekday_alarm_time') }} in templates, it will return True now. I have changed my trigger accordingly, but it does not work.
Do I need to specify that this has to be checked once every minute? Or did I miss something else?
If you use the trigger I posted it should trigger when the two sensors have the same value, and then it won’t trigger again until they first do not equal, and then become equal again, just as you’d want.
The way it works is, the template will be evaluated anytime either of the sensors changes. So, since sensor.time changes once a minute, it is effectively evaluated at least every minute.
If it’s not “working” then there is probably a problem somewhere else. Either the automation is not turned on, or a condition is preventing it from running when it should, or… Please post the automation as it stands now.
scene.wecker will turn on light.schlafzimmer_bett_led, so this is how I tested this
set weekday alarm to 16:26 when it was around 16:24-16:25 (I have changed steps by 5 to steps by 2 in order to be able to test this more than every 5 minutes)
wait until it was actually 16:26
check whether scene.wecker and/or light.schlafzimmer_bett_led appeared in the log
manually checked whether light.schlafzimmer_bett_led was turned on (which it should be if triggered by this)
EDIT: oh, and input_boolean.weekday_sunrise is on.
You should also see that the automation triggered in the logbook. And if you look at the automation on the states page you should see its last_triggered attribute should have been updated.
If you indeed have sensor.time, and it’s updating correctly, and sensor.weekday_alarm_time has values in exactly the same format as sensor.time (no extra spaces, etc.), then I don’t see why this won’t trigger. Maybe try commenting out the condition section as another test???
This was my fault. For some reason, I had two input_booleans for weekday and weekend, but there was only one single automation - when there should have been two. I don’t quite understand why, but while I did have an automation for the weekend, there was none for weekday to be found. So I changed to weekend automation to include every day of the week, set the timer, and it worked!
Either way, thank you so much for your help
EDIT: the reason why I had only one automation working was that I probably never will see errors in yaml right away. I should have had it like
automation:
- id:
(...)
- id:
(...)
Instead, I only had id: without a dash in front of it. So only the first automation was created. I changed this now and believe that it should work (still changing variable names etc. before final test)