From LedHed's Wiki
Revision as of 07:30, 1 June 2021 by Ledhed (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

Its common practice to create an Isolated VLAN for Home Automation gear and IoT devices. Doing so will make your environment inherently more secure, but it also presents challenges. In my case my Home Assistant server wasn't keeping accurate time. This article will briefly demonstrate how to change the NTP server Home Assistant connects to for time syncronizations.


Background Info

HassOS runs on an Overlay File System, which means that edits to files from the command line won't survive a reboot (assuming you can even make changes, often times you'll get an error stating that its a Read-Only File System). So how do you make changes?
First: Read [1] I had done this, but had challenges getting the USB stick to passthrough to my HassOS VM on Boot. So I went the alternative route by creating a CONFIG folder in the boot partition, BUT WHERE IS THE BOOT PARTITION!!! Open the console of your HassOS and login as root. Then at the command line type: logon

ha > login
# mkdir -p /mnt/boot/CONFIG
# echo -e "[Time]\nNTP=10.20.30.40\nFallbackNTP=10.20.30.41" > /mnt/boot/CONFIG/timesyncd.conf

Replace 10.20.30.40 and 10.20.30.41 with your desired NTP servers.
Alternatively you can:

# vi /mnt/boot/CONFIG/timesyncd.conf
[Time]
NTP=10.20.30.40
FallbackNTP=10.20.30.41

Once /mnt/boot/CONFIG/timesyncd.conf has been created you can reboot the Host

# reboot

Notes

You can confirm the changes by logging in again and running:

# cat /etc/systemd/timesyncd.conf

It should reflect the changes you made above.
I also noticed that the /mnt/boot/CONFIG folder is removed after reboot. This is normal, and your changes should persist future reboots.


Reference

https://github.com/home-assistant/operating-system/blob/dev/Documentation/configuration.md

https://github.com/home-assistant/supervisor/issues/957#issuecomment-528948200