Yes that is what I mean. It will only be true momentarily true as now() (contrary to what I said earlier) has 5 decimal places. Probably better set it to an integer first.
So it will be true only for a fraction of time?
My goal was for a minute (not using seconds). That is where I started messing with those strings (and as I stated, I assumed I needed this as integer).
Again, unfortunately time & date are still my nightmare…
Sure you can ask No particular reason, but it should be more than a 1/100 second, as I want to trigger automations and scripts based on this binary_sensor. Probably a second is more than enough - never done any testing if there are any delays from a binary_sensor switches between true/false to trigger an automation.
I make a lot of stuff regarding templates, sensors and stuff - though as stated - I hate time & date.
As far as I know, timestamp is just the number of seconds passed since 1. January 1970. So the binary_sensor should be on for one second, I think this should be enough to trigger automations.
I’m not sure if i’m losing something but those aren’t “equal” from what you posted.
try using a < or > just to make sure you are on the right track. one or the other must be true unless they are truly equal for 1 second.
the other thing to remember is that the template editor won’t update in real time. you have to modify the contents of that page before it will update the results. So you would literally have to make a change to the text every second to see it switch from false to true to false again.
Actually, I think I’ve found the reason for not getting the == (or why it is incredible short state).
As I have programmed alarms for every day in the morning, as soon as the ((now)) == alarm-sensor, the alarm-sensor updates to the next alarm time, and ((now)) is again < sensor-alarm.
I did turn off all alarms, created a one-time alarm on the android device, using this:
{{ as_timestamp(now()) | int > as_timestamp(states('sensor.arielam30_arielam30_alarm_sensor')) | int }}
Guess what, as soon as the alarm started, it changed from False to True, meaning the rule works but I assume as the alarm-sensor as soon it is triggered by the ==, it resets to next alarm. Perhaps HA doesn’t even get tu update the binary_sensor?
So, for what Mattias wrote in his sensor, it would be smart to actually trigger the binary_sensor a bit before they actually are ==. See my point?
Maybe it would be helpful for you to post the entire code for your binary_sensor instead of the just the template. You might be doing something else in that code that is preventing the sensor from updating…
I just did a test to turn on an input boolean based on now being equal to an input datetime making the seconds required to be equal and it worked for me.
Here is the working solution, it turn on the binary_sensor 3 minutes before it actually should trigger. One of the issues earlier was exactly the part that as there is a new alarm coming up, somehow the sensor did never flip from ‘false’ to ‘true’.
I can edit the time before by changing the <= 0.002 % which I changed to 0.002 % = approx 3 minutes. Now I can trigger my morning routine where I actually do all the stuff that doesn’t work with Google Home in countries outside US; wish me good morning, turn on lights, open bliders, give me the weather report and turn on the radio on the Google Home.