homeassistant

Install Home Assistant on Raspberry Pi

Install Home Assistant on Raspberry Pi
https://www.home-assistant.io/installation/raspberrypi/

# Install rpi-imager
sudo apt install rpi-imager
 
# Create Homeassistant SD-Card
# Other specific-purpose OS > Home assistants and home Automation > Home Assistant OS
 
# Connect to HA
http://YOUR_HOME_ASSISTANT_IP:8123/
 
# Create Home Assistant account
 
# Install SSH plugin in Add-on-Store
http://YOUR_HOME_ASSISTANT_IP:8123/hassio/addon/core_ssh/info
 
# Open SSH Web CLI
http://YOUR_HOME_ASSISTANT_IP:8123/hassio/ingress/core_ssh
 
# get wifi data from workstation
WIFI_SSID="$(nmcli dev wifi show-password | grep SSID | cut -d' ' -f2-)" 
WIFI_PASS="$(nmcli dev wifi show-password | grep Pass | cut -d' ' -f2-)"
echo ha network update wlan0 \
  --ipv4-method auto \
  --wifi-auth wpa-psk \
  --wifi-mode infrastructure \
  --wifi-ssid \'${WIFI_SSID}\' \
  --wifi-psk \'${WIFI_PASS}\'
 
# paste output to SSH online console 
 
# debug
ha network info

Enable SSH key to hypervisor (Raspberry Pi)
https://community.home-assistant.io/t/howto-how-to-access-the-home-assistant-os-host-itself-over-ssh/263352/6

Home Assistant MQTT

Install MQTT broker (server) on Anroid
https://apkpure.com/mqtt-broker-app/server.com.mqtt/download

Create MQTT sensor
https://www.home-assistant.io/integrations/sensor.mqtt/

# ~/.homeassistant/configuration.yam
...
mqtt:
  sensor:
    - name: "Inverter AC Power"
      unique_id: "inverter_ac"
      state_topic: "inverter/HM/ch0/P_AC"
      unit_of_measurement: "W"
      device_class: "energy"
      state_class: "measurement"
    - name: "Inverter DC Power"
      unique_id: "inverter_dc"
      state_topic: "inverter/HM/ch0/P_DC"
      unit_of_measurement: "W"
      device_class: "energy"
      state_class: "measurement"
    - name: "Inverter DC Power CH1"
      unique_id: "inverter_dc_ch1"
      state_topic: "inverter/HM/ch1/P_DC"
      unit_of_measurement: "W"
      device_class: "energy"
      state_class: "measurement"
    - name: "Inverter DC Power CH2"
      unique_id: "inverter_dc_ch2"
      state_topic: "inverter/HM/ch2/P_DC"
      unit_of_measurement: "W"
      device_class: "energy"
      state_class: "measurement"
    - name: "Inverter Yield Day"
      unique_id: "inverter_yield_day"
      state_topic: "inverter/HM/ch0/YieldDay"
      unit_of_measurement: "Wh"
    - name: "Inverter Yield Total"
      unique_id: "inverter_yield_total"
      state_topic: "inverter/HM/ch0/YieldTotal"
      unit_of_measurement: "kWh"
      device_class: "energy"
      state_class: "measurement"
    - name: "Inverter Temperature"
      unique_id: "inverter_temperature"
      state_topic: "inverter/HM/ch0/Temp"
      unit_of_measurement: "°C"
      icon: "mdi:thermometer"

Debug MQTT
http://mqtt-explorer.com/
https://snapcraft.io/install/mqtt-explorer/ubuntu#install

Home Assistant

Install Home Assistant as Docker container
https://www.home-assistant.io/installation/linux#platform-installation

docker run -d \
  --name homeassistant \
  --privileged \
  --restart=unless-stopped \
  -e TZ=Europe/Berlin \
  -v homeassistant:/config \
  --network=host \
  ghcr.io/home-assistant/home-assistant:stable
 
# volume path
# /var/lib/docker/volumes/homeassistant

Configure
http://127.0.0.1:8123

Install HACS

sudo docker exec -it homeassistant bash
wget -O - https://get.hacs.xyz | bash -

Addons / Plugins
LocaTuya: https://github.com/rospogrigio/localtuya/

custom_zha_quirks
https://smarthomescene.com/reviews/tuya-zigbee-single-clamp-energy-meter-review/