homeassistent - bunnyamin/bunnix GitHub Wiki
- Download the Home assistant OS image
- Create a qemu VM for the OS image
- Start the VM
- Access
http://localhost:8123/
- Setup controller:
- Add the device controller in the "Home assistent OS":
- "Settings" > "Devices & Services" > "Add integration" > Select "Z-wave"
-
Add device in the "Home assistant OS":
- "Settings" > "Devices & Services" > "Add integration" > "Add Z-wave device"
- Install Home Assistant Core
- Update Home Assistant Core Common tasks - Core
sudo -u homeassistant -H -s
cd ~
python3 -m venv .
source bin/activate
pip3 install --upgrade homeassistant
Home assistant | Arch Linux |
---|---|
build-essential | base-devel |
libatlas | libatlas (AUR) |
zlib1g | zlib |
Follow the official instructions.
sudo -u /home/homeassistant -H -s
cd /install/path/homeassistant
python3 -m venv .
source bin/activate
pip3 install homeassistant
Moving the installed Home assistant core from one path to another causes failure
in execution from the new path. The problem is that the original path is written
into several files. For example, search for /install/path/homeassistant
grep --text -r '/install/path/homeassistant' /install/path/homeassistant/
Therefore, after moving the installed Home directory core to a new path, find and replace all references to the old path with the new path. For example,
find /new/path/homeassistant -type f -exec sed -i 's|/install/path/homeassistant|/new/path/homeassistant|g' {} \;
- Community guides Autostart using systemd
Create the service file /etc/systemd/system/homeassistant@<USER>.service
[Unit]
Description=Home Assistant
After=network-online.target
[Service]
Type=simple
User=%i
WorkingDirectory=/home/%i/.homeassistant
ExecStart=/sub/homeassistant/bin/hass -c "/home/%i/.homeassistant"
RestartForceExitStatus=100
[Install]
WantedBy=multi-user.target
Fallow the official instructions. Observe the following:
- Restore security keys from backup. If no previous security keys exists then create new ones and back them up.
- Enable "WS Server" in
Menu > Settings > Home Assistant
If the user is not root:
- Create a group
groupadd zwave
, or reuse an existing group. - Change the group for
/dev/ttyACM0
tochgrp zwave /dev/ttyACM0
. - Change the permission for
/dev/ttyACM0
tochmod g+rw /dev/ttyACM0
. - Add the intended user for the VM to group
usermod -aG zwave user
. - If everything works, and the changes are intended to be permanent, create
/etc/udev/rules.d/97-ttyacm.rules
:- Identify property:
$ udevadm info --attribute-walk --path=$(udevadm info --query=path --name=/dev/ttyACM0)
- Write appropriate Udev rule:
KERNEL=="ttyACM[0-9]", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idProduct}=="<ID>", ATTRS{idVendor}=="<ID>", GROUP="zwave", MODE="660"
udevadm test $(udevadm info --query=path --name=/dev/ttyACM0) 2>&1
- The rule should be applied after reboot.
- Enable changes directly
udevadm trigger --type=devices --sysname-match=ttyACM[0-9]
- Identify property:
Two parameters are required to pass through the "serial character device", also called TTY (teleprinter, teletype, teletypewriter), from the host to the guest:
- Define the "back end":
-chardev serial,path=/dev/ttyACM0,id=acm
, or with a more persistent pathchardev serial,path=/dev/serial/by-id/usb-0000_0000-if00,id=acm
- Define the "front end":
-usb -device usb-serial,chardev=acm
Note that the parameter "serial" is the new term for "tty" which is deprecated. For example,
-
-chardev tty,...
raisesThe alias 'tty' is deprecated, use 'serial' instead
.
-
login
to leave the "HA" CLI and enter into the Linux CLI. -
exit
to leave the Linux CLI and reenter into the HA CLI.
Shutdown Home assistant OS
-
ssh -x [email protected] -p 9999 -i ~/.ssh/prv/root\@homeassistant 'source /etc/profile.d/homeassistant.sh && ha host shutdown'
"The command line ha needs a token to work. To have the environment variable SUPERVISOR_TOKEN you need to call a script to set this variable." Answer by xen to question Error when trying to run “ha snapshots new” over ssh.
- Forward a host port to a guest port:
qemu-system-x86_64 ... -nic user,hostfwd=tcp::<HOST PORT>9999-:<GUEST PORT>22
- Login to the guest from the host local network:
ssh -vx [email protected] -p 9999
orssh -vx root@localhost -p 9999
- Starting QEMU virtual machines on boot
- Answer by Oxyd to question How to I gracefully shutdown my kvm virtual machines when shutting down the host?
For example,
- the SystemD [email protected],
- the Qemu daemon for homeassistant
Error | Event | Consequence | Cause | Remedy |
---|---|---|---|---|
'AddonManager.install' blocked from execution, no host internet connection |
Trying to install add-on | host_internet: false |
Degbug connection issues | |
ERROR (MainThread) [aiohttp.server] Error handling request ... "homeassistant/lib/python3.9/site-packages/aiohttp/web_protocol.py" ... aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'Invalid method encountered ... |
Connecting to localhost:8123 | Web page does not load | Ensure connection to localhost is HTTP and not HTTPS. |
In the HA command line:
- Leave the HS shell:
login
- Ping IP and domains to test connection. For example,
ping 1.1.1.1
andping example.org
. - NSlookup
nslookup example.org
If all the tests fail, ensure that there are no firewall rules preventing access to and from the HTTP and HTTPS port. If the name lookup fails, then it could indicate a problem with the DNS.
Started Home Assistant.
... hass[54144]: Traceback (most recent call last):
... hass[54144]: File "/sub/homeassistant/bin/hass", line 5, in <module>
... hass[54144]: from homeassistant.__main__ import main
... hass[54144]: ModuleNotFoundError: No module named 'homeassistant'
[Re-]Install Home assistant.