My automation time trigger does not start on time, normally starts about 2 minutes after the specified time. It then has a delay which also takes longer before the next step is triggered. I’ve done a fresh install of Home Assistant and kept the configuration to a minimum and the same still occurs. I don’t see any errors in the logs.
Searched the forums but don’t see similar issues reported. How should I go about troubleshooting this ?
Triggered by the time at May 13, 2021, 7:47:17 PM Call service switch.turn_on on entities switch.sonoff_1000ff0059 Geyser (switch.sonoff_1000ff0059) turned on Delay for {“hours”:0,“minutes”:5,“seconds”:0,“milliseconds”:0} 9 minutes later Call service switch.turn_off on entities switch.sonoff_1000ff0059 Geyser (switch.sonoff_1000ff0059) turned off Finished at May 13, 2021, 7:56:03 PM (runtime: 526.38 seconds)
I have but just tried it again, changed both the time and delay to double quotes. It still triggered late, only 24 seconds but the delay run for 13 instead of 5 minutes. Don’t think it’s the cause of the issue. I also tried an automation using numeric state trigger of an input number which I change in the UI, the trigger fires immediately. Seems like it’s only time based triggers that is slow to run.
I wonder if that is the reason why. Perhaps the host doesn’t have enough resources or threads to run the virtual HA in a timely fashion. How much memory did you allocate to HA on the VM? Are there a lot of other things on the host vying for the CPU’s attention?
I didn’t, added one now. It appears to run slow but does jump forward because the difference between the host and HA time is not constant.
It does run slower, I ran the time command on the host and guest operating systems a few times, strange thing is the difference is not constant. The second run was pretty close, only 3 second difference, a second of that time is probably my reaction time between hitting the enter key in the two consoles.The biggest difference was almost a minute
Windows 10 host running VirtualBox with latest VDI image. It’s running on an old laptop with new SSD disk, the memory is low though, only has 2GB with 1GB allocated to the VM.
The host runs two small console apps I wrote in c# to connect to my alarm system and inverter which send mqtt messages to HA, other than that it’s dedicated to the HA VM. I ran the same apps and HA on a very old 32bit laptop which meant I had to run the Python version of HA which don’t have Supervisor, etc. I then moved it to a newer, but still old, laptop running VirtualBox with HA VM. This is when the problem started, I then did a clean install, at the moment there is nothing other than HA running to test the time issue in isolation.
The laptop only has 2GB memory, of which 1GB is allocated to the VM. Might be related to resources, but then I would have expected other trigger types to be impacted as well, looks like it’s only time having the issue.
I think that’s your problem.
1 GB for HA OS should be ok, but W10 with 1GB Memory?
One thing you could try is to google for ‘virtualbox guest time slow’, maybe there’s a workaround, but i don’t think so.
Like @VDRainer mentioned, 1GB seems a bit tight for HA. Isn’t the minimum 2GB?
It depends on what the other events are doing and if anything else might be running at this time. With so few resources, perhaps communicating over wifi is what is the problem at that time or there’s something else happening on the host or on HA at that time that is causing the delay.
As a test I used VMware Player instead of VirtualBox on the same laptop, and the time “jumping forward” issue disappeared. It’s been running for a few days now and all the time triggers and delays are working 100%.