I noticed the lag when the automation triggers. So e.g. if the text file is at 18:00 and when the time sensor hits 18:00 the automation does not trigger by the second rather it triggers after 5-8 seconds.
I noticed this lag with the time sensor itself i.e. when the minute changes it does not change and has a lag of 5-8seconds. So it could be the reason why the automation has a lag.
Do you know how I could reduce the time in seconds ?
Just to jump in, I think the 5 second lag you are talking about is unavoidable, since there is some time involved in sending the message to the cloud and it arriving at your phone (I am assuming iOS notifications and these are not processed locally, the cloud is involved).
I, for example, am not using a time-comparison trigger as you are; I send a notification when my garage door opens. Sure enough, the door opens, and several seconds later I get the notification.
Exactly. Whatever notification service you are using, it always will have some sort of delay, shorter or longer. So, using HA as a tea timer might not be the best idea. But that is not HAs fault but rather cause by the accumulation of latencies of different systems being used.
I am certain it’s nothing to do with the notification instead it’s the time component which is the issue as I have monitored it and when the minutes changel the time on HA frontend lags for about 5 seconds.
What’s exactly the problem? What are your trying to do that 5 seconds delay/lag is such a big issue for getting notified? Which notification component are you using?
I have tried to implement it and this is what I have come up with but gives me error in this line {{ is_state('sensor.manutd', is_state('sensor.time')) }}
so I used this {{ states.sensor.manutd.state == states.sensor.time.state }} but I get the following error :
2017-10-20 15:24:20 ERROR (Thread-2) [homeassistant.util.yaml] while scanning for the next token
found character '\t' that cannot start any token
in "/home/homeassistant/.homeassistant/configuration.yaml", line 68, column 1
2017-10-20 15:24:20 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: while scanning for the next token
found character '\t' that cannot start any token
in "/home/homeassistant/.homeassistant/configuration.yaml", line 68, column 1
Line 68 is {{ states.sensor.manutd.state == states.sensor.time.state }}
I know some of us sound like a broken record, but why is the timing so critical that 8 seconds is a problem? What specifically are you trying to do?
This is an important question, because some user might have a good way to accomplish what you want, but without the struggles and complications you’re having now.
Sorry for my novelty but do I expect to see the binary sensor on the front end? I have tried looking for it as a senor in the states page but cannot see it. I have done a test run when the sensor.manutd is equal to sensor.time.
Hey @Dolores, @RobDYI has just explained what I am trying to achieve.
If anyone of you could please try to use the time component the way I have used it, you might actually see what I am trying to explain all this time (and the lag).
The lag is important because the time component is not in sync in general with HA and it defeats the purpose really of having a “time” component.
The trouble is, Home Assistant isn’t a real time platform and doesn’t pretend to be one. There’s always going to be delays, even when everything is purely internal to the system you’re running it on. Using a template like that slows things down again, and may well be the primary source of the delay.
The best you’re likely to achieve is to identify the typical range, and instead set it to trigger one minute earlier, then have a delay of (say) 52 seconds. That’s horribly, horribly, inefficient, but it may achieve what you’re after.
My purely time based automations generally fire within 2 minutes of the designated time (so, if due to trigger at 06:00 they’ll trigger between 06:00 and 06:01 inclusive).