Hi folks,
I have a weird problem which sometimes occur and which I can solve after a long time of trials.
My Hame Assistant (as OS) is running on a raspberry pi 4 without internet connection. It is used for a small flat where no internet is available.
Sometimes (after a blackout) the raspberry is loosing its internal date and time. After rebooting of the pi the web interface is (sometimes) not accessible, but all of the automation and control is working. I use mainly zigbee sensors and actuators.
I am sure the reason is the missmatch of times and dates between the router and the raspberry pi.
Do you have an idea how to manually correct the date and time at the raspberry pi by the command line interface?
In CLI of the homeassistant one can use the date-command, but in my case it sayes it is prohibitted to change the date and time.
I can resolve the problem, when I use my loptop and enter the wifi of the local router. When I restart the raspberry pi, the webinterface is usually accessible again.
Last time it took me 3 attempts and then it worked again. Does anyone have an idea how to solve this problem directly?
Kind regards
Chris
Hi,
Maybe this post contains some useful info on this.
This is going to depend on your specific network topology.
If your pi is connected to a router, you should consider setting it to DHCP, and binding it to the desired IP address there. If that’s the case, it should sync time with the router.
Mismatch likely occurs because the rpi boots faster than your router, and has no time server available.
Further down that thread this quick fix is mentioned.
Thanks for your recommadation. Indien I assigned a Status ip Number at HA.
I will give it a try, keep the raspberry at dhcp and fix the ip number at the routers side.
A RPi does not - unlike a normal PC - have the ability to store the date/time and retrieve it after a power failure.
It uses NTP to get the correct date/time from the internet, so if your RPi has no internet connection…
If there is a device on the local network that is able to act as a NTP server, you could use that.
You can run an NTP server on your Pi directly. That’s called a Stratum 1 server. As time source you can use a cheap GPS dongle or module (GPS satellites have atomic clocks onboard). That’s what I do for my isolated IoT network, so all connected devices get NTP time without internet connection.
Another alternative is to add a hardware RTC to your Pi. Like all RTCs, it will start drifting after a while.
I have no idea how and whether any of this works on HAOS, since that OS is so locked down.
Hi! Is there anybody who knows if one can use a RTC (DS3231) with a Raspberry PI 4 in Home Assistant OS. My installed version is HA OS Core. There is no full raspbian installed!
I would appreciate if some can send me a point to point description for that.
Thanks!
It’s either HA-OS (mostly referred to as HAOS) or HA Core.
With HAOS, you don’t have much options in the OS since it’s a locked, slimmed down OS just for HA…
Sorry it is HA-OS. OK is there another opportunity to integrate a RTC? GPS is not so useful since, my rpi is located indoor in a flat.
Like already stated (also by Alex) is that you cannot do much outside of the scope of HAOS on a RPi so anything that requires software will most likely not be possible.
There are 2 options you have that I can think of:
- use a powerbank with the RPi so that during a powerfailure it keeps running
- adjust the clock manually every time after a powerfailure