homeassistent - bunnyamin/bunnix GitHub Wiki

Home assistant OS

  1. Download the Home assistant OS image
  2. Create a qemu VM for the OS image
  3. Start the VM
  4. Access http://localhost:8123/
  5. Setup controller:
  6. Add the device controller in the "Home assistent OS":
    • "Settings" > "Devices & Services" > "Add integration" > Select "Z-wave"
  7. Add device in the "Home assistant OS":
    • "Settings" > "Devices & Services" > "Add integration" > "Add Z-wave device"

Home Assistant Container (Docker)

Download the docker image

  • sudo docker pull ghcr.io/home-assistant/home-assistant:stable

SystemD

[Unit]
Description=Home Assistant (docker)
Requires=docker.service
After=docker.service

[Service]
Restart=always
RestartSec=3
ExecStart=/usr/bin/docker run --name=home-assistant-%i \
  -v /home/%i/.homeassistant/:/config \
  -v /etc/localtime:/etc/localtime:ro \
  --net=host \
  --device /dev/zw090:/dev/zw090 \
  ghcr.io/home-assistant/home-assistant:stable


ExecStop=/usr/bin/docker stop -t 2 home-assistant-%i
ExecStopPost=/usr/bin/docker rm -f home-assistant-%i

[Install]
WantedBy=multi-user.target

Home assistant core - Deprecated (2025-05-22)

Home assistant Arch Linux
build-essential base-devel
libatlas libatlas (AUR)
zlib1g zlib

Follow the official instructions:

  1. sudo -u /home/homeassistant -H -s
  2. cd /install/path/homeassistant
  3. python3 -m venv .
  4. source bin/activate
  5. pip3 install homeassistant

Moving an installation

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' {} \;

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=/home/homeassistant/bin/hass -c "/home/%i/.homeassistant"
RestartForceExitStatus=100

[Install]
WantedBy=multi-user.target

Z-wave

Fallow the official instructions. Observe the following:

  1. Restore security keys from backup. If no previous security keys exists then create new ones and back them up.
  2. Enable "WS Server": Home Assistant: Settings: Devices & services
    • If first time: + Add integration
    • If device already added: Select "Z-Wave" and "Migrate or reconfigure"
      • If same device new settings: "Reconfigure the current adapter"
        • Update the Server Websocket: ws://<SERVER IP>:3000
      • If new device: "Migrate to a new adapter"

Docker

  • Download the latest image docker pull zwavejs/zwave-js-ui:latest

SystemD

[Unit]
Description=Z-Wave JS UI (docker)
Requires=docker.service
After=docker.service

[Service]
Restart=always
RestartSec=3
ExecStart=/usr/bin/docker run --name=zwave-js-ui \
  -p 8091:8091 \
  -p 3000:3000 \
  --device=/dev/zw090:/dev/zw090 \
  -v /home/zwave/:/usr/src/app/store \
  zwavejs/zwave-js-ui:latest

ExecStop=/usr/bin/docker stop -t 2 zwave-js-ui
ExecStopPost=/usr/bin/docker rm -f zwave-js-ui

[Install]
WantedBy=multi-user.target

Hardware

Zwave USB Controller

  • Most likely kernel module dependency: CP210x

Add necessary permission

Create a udev rule: /etc/udev/rules.d/97-ttyacm.rules:

  1. Identify property: $ udevadm info --attribute-walk --path=$(udevadm info --query=path --name=/dev/ttyACM0)
  2. SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0658", ATTRS{idProduct}=="0200", GROUP="zwave", MODE="660", SYMLINK+="zw090"
    • SYMLINK+="zw090" creates a custom symlink ID, e.g. /dev/by-id/zw090
  3. udevadm test $(udevadm info --query=path --name=/dev/ttyACM0) 2>&1
  4. The rule should be applied after reboot.
    • Enable changes directly udevadm trigger --type=devices

Qemu

Two parameters are required to pass through the "serial character device", also called TTY (teleprinter, teletype, teletypewriter), from the host to the guest:

  1. Define the "back end": -chardev serial,path=/dev/ttyACM0,id=acm, or with a more persistent path chardev serial,path=/dev/serial/by-id/usb-0000_0000-if00,id=acm
  2. 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,... raises The alias 'tty' is deprecated, use 'serial' instead.

Home assistant shell

  • login to leave the "HA" CLI and enter into the Linux CLI.
  • exit to leave the Linux CLI and reenter into the HA CLI.

SSH

Shutdown Home assistant OS

Qemu

  • 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 or ssh -vx root@localhost -p 9999

SystemD

Qemu

For example,

Error, problem, troubleshooting

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.

Debug connection issues

In the HA command line:

  • Leave the HS shell: login
  • Ping IP and domains to test connection. For example, ping 1.1.1.1 and ping 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.

ModuleNotFoundError: No module named 'homeassistant'

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.

⚠️ **GitHub.com Fallback** ⚠️