Use the systemd-timesyncd service as explained here
Here are the time servers that I used.
NTP=0.north-america.pool.ntp.org 1.north-america.pool.ntp.org 2.north-america.pool.ntp.org 3.north-america.pool.ntp.org
FallbackNTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org
- To stop HA
sudo systemctl stop home-assistant@homeassistant - To start HA
sudo systemctl start home-assistant@homeassistant - To restart HA
sudo systemctl restart home-assistant@homeassistant - To check realtime logs
sudo journalctl -f -u home-assistant@homeassistant - To check logs
sudo systemctl status -l home-assistant@homeassistant
Thanks to @dale3h for assistance with these instructions.
-
Install
gitusingsudo apt-get install git -
Go to https://github.com/new and create a new repository. I named mine
HASS. Initialize withreadme: noand.gitignore: none. -
Navigate to your
.homeassistantdirectory. For AIO, it should be/home/hass/.homeassistant, and for HASSbian, it is/home/homeassistant/.homeassistant. -
Run
sudo su -s /bin/bash hassfor AIO andsudo su -s /bin/bash homeassistantfor HASSbian. -
Run
wget https://raw.githubusercontent.com/arsaboo/homeassistant-config/master/.gitignoreto get the.gitignorefile from your repo (replace the link to match your repository). You can add things to your.gitignorefile that you do not want to be uploaded. -
Next, we need to add SSH keys to your Github account.
- Navigate to
cd /home/hass/.ssh(for AIO). If you don't have.sshdirectory, create one and change the permissionchmod 700 ~/.ssh. - Run
ssh-keygen -t rsa -b 4096 -C "homeassistant@pi". If you want to enter a passphrase, that's up to you. If you do, you'll have to enter that passphrase any time you want to update your changes to github. If you do not want a passphrase, leave it blank and just hitEnter. - Save the key in the default location (press
Enterwhen it prompts for location). - When you're finished, run
ls -al ~/.sshto confirm that you have bothid_rsaandid_rsa.pubfiles. - Go to https://github.com/settings/keys and click
New SSH keybutton at top right. Title:homeassistant@pi(or whatever you want, really...it's just for you to know which key it is) - Run
cat id_rsa.pubin the SSH session and copy/paste the output to that github page. - Then click
Add SSH keybutton.
- Navigate to
-
Go back to your repo page on GitHub. It'll be something like https://github.com/yourusernamehere/homeassistant-config. Click the green
Clone or downloadbutton, and then clickUse SSH. -
You should see something like this in the textbox:
git@github.com:yourusername/homeassistant-config.git. Copy that to your clipboard. -
Now you are ready to upload the files to GitHub.
- Navigate to
cd ~/.homeassistant git initgit add .git commit -m 'initial commit'- If you get an error about
*** Please tell me who you are., rungit config --global user.email "your@email.here"andgit config --global user.name "Your Name" - After that commit succeeds, run:
git remote add origin git@github.com:yourusername/homeassistant-config.git(make sure you enter the correct repo URL here) - Just to confirm everything is right, run
git remote -vand you should see:hass@raspberrypi:~/.homeassistant$ git remote -v origin git@github.com:arsaboo/homeassistant-config.git (fetch) origin git@github.com:arsaboo/homeassistant-config.git (push) - Finally, run
git push origin master.
- Navigate to
-
For subsequent updates:
cd /home/homeassistant/.homeassistantsudo su -s /bin/bash homeassistantgit add .git commit -m 'your commit message'git push origin master
-
To restore from your Github repository (replace the URL):
sudo su -s /bin/bash homeassistant cd /home/homeassistant git clone git@github.com:arsaboo/homeassistant-config.git .homeassistant
- Login to system. HASS configuration files are saved in
/home/homeassistant/.homeassistantand the code files are saved in/srv/homeassistant/lib/python3.5/site-packages/homeassistant/. - Change to homeassistant user
sudo su -s /bin/bash homeassistant - Change to virtual enviroment
source /srv/homeassistant/bin/activate - Update HA
pip3 install --upgrade homeassistant. To update to a different branch, use the complete git URL,pip3 install --upgrade git+git://github.com/home-assistant/home-assistant.git@dev - Type
exitto logout the hass user and return to thepiuser. - Restart the Home-Assistant Service
sudo systemctl restart home-assistant@homeassistant
- You can test the Read Speed of your SD card using (note, this command takes some time to run):
sudo dd if=/dev/mmcblk0 of=/dev/null bs=8M count=100 sudo hdparm -t /dev/mmcblk0 - Many of the problems with Pi are related to faulty power supply. You can use
vcgencmd get_throttledto check if your Pi is getting adequate power supply. You want that to returnthrottled=0x0. If not it means that the Raspberry is throttling itself due to low voltage, or other factors. - Test Write speed (will create 200MB file in /home/pi/testfile) using
dd if=/dev/zero of=/home/pi/testfile bs=8M count=25 - To check which files are using up all the space on your SD card, run
sudo du | sort -n. You can delete the culprits using something likesudo rm -rf ./.pm2/logs/(will recursively delete folder /logs/).