As a newbie to Homeassistant, it seems like there is no way run automations at specific times (say “turn the lights on at 11:30pm”) unless there is a connection to the internet.
I’m trying to set just such a system where the internet is, for all practical purposes, unavailable . So I’m wondering if anyone has come up with a workaround with a local time provider.
So far I’ve got home assist running on a raspberry pi with shelly switches and a wifi router.
I haven’t seen where HA has its own system time or where it gets it from.
I’m happy to be proved wrong, but all the Shelly products I’ve seen say they require to be connected to the internet to trigger on time and the Raspberry pi does not seem to have a clock as standard - especially not one that can adapt to daylight saving time. That being the case I can’t see how Home assistant can know and use the time without access to internet data.
I mean, have you tried checking? Disconnect HA from the internet, restart it, and just put {{ now() }} in the template editor or something and see if you get valid output.
Shelly trigger is Shelly trigger but has nothing to do with HA trigger.
HA only ON/OFF shelly but when HA “trigger by time” it will not launch shelly side automation trigger.
When HA trigger by time, it simply Turn ON/OFF Shelly device I expect.
HA should only use underlying OS system clock. This is not Hardware clock but OS software clock. This clock not Require internet but you may need to take action to ensure it correct at first time start server.
I think this applies to Raspi as well. I imagine HAOS use same or similar.
Yes. if never connect to internet it will not be correct but this is expected as it has no method for know time at first start. If hardware not have battery to maintain system time during Power OFF moment then again, time need to be manually set at first start server if no internet connection. This all seem normal unless connected with GPS.
Raspi has no Real Time Clock, so when power goes so does the clock.
It is possible to get a RTC for the Raspi and they are quite cheap, but the downside is you might lose the option to use a HAT on it.
As I understand it, the Raspi has no RTC and will rely on a time source at boot time. Once that is established, the underlying OS will maintain accurate timekeeping as long as the OS remains online. The system clock does not rely on an Internet connection to stay accurate short term. Over time (days, weeks, etc.) there will likely be some drift (a few seconds?) until it reaches a time source to synchronize the system clock once again. Most systems only synchronize their system clock once an hour or just daily.
I’m sorry, what?!
The Raspberry Pi is running a Linux operating system, whether it is Raspbian or Home Assistant OS. Linux has time zone support with daylight savings offset built in. It’s part of tzdata.
If you want the Raspberry Pi to have a working clock, out of the box without needing to get an initial time sync from the internet at boot, there are options.
Use ANY computer on your entire network as the time server for the rest of the network, and tell the Pi to use YOUR LOCAL timeserver instead of one on the internet.
Thanks all and thanks especially Andrew. That made me laugh out loud - (I am a real noob to all this). Didn’t know the pi stored time zone and daylight saving
I’ll go down the route of getting an RTC added to the pi and take it from there.
The Pi, and all machines running Linux, probably even Windows these days - deal with time internally as UTC/GMT+0, the tzdata package then allows the user to specify what timezone they are in, and included in the package are rules about how each location changes forward and back, and when it happens. But the most important thing is that Linux (and other operating systems) - deal with Time internally as UTC, and actually as the number of seconds since midnight on Jan 1st 1970.