Skip to content

andornaut/ansible-role-homeassistant-frigate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ansible-role-homeassistant-frigate

An Ansible role that provisions Home Assistant, Frigate, and Mosquitto Docker containers.

homeassistant frigate

Hardware

Bluetooth CSR8510 adapter

# Setup dbus-broker
apt install dbus-broker
systemctl enable dbus-broker.service

# Make /run/dbus accessible from inside the container by editing host_vars/${host}:
homeassistantfrigate_extra_volumes:
  - "/run/dbus:/run/dbus:ro"

ratgdo - Local MQTT & dry contact control of Chamberlain/LiftMaster Security+ 2.0 garage door openers

Getting started

  1. Flash the "ratgdo v2.51, Security + 1.0, 2.0 & Dry Contact" firmware using this webapp

  2. Navigate to the admin web interface

  3. Set a MQTT IP and port:1883. You must use an IP not a hostname.

  4. Leave the "Home Assistant Discovery Prefix" at its default "homeassistant"

  5. Wire the ratgdo to the garage door opener according to this diagram

  6. Navigate to Home Assistant > Settings > Devices & services > Devices and then search for "ratgdo"

  7. Add a new card to your dashboard:

    show_name: true
    show_icon: true
    type: button
     entity: cover.ratgdo_door
    name: Garage Door
    tap_action:
      action: toggle
    show_state: true
    

Upgrading SONOFF Zigbee 3.0 USB Dongle Plus (ZBDongle-P) firmware:

docker stop homeassistant
docker run --rm \
    --device /dev/ttyUSB0:/dev/ttyUSB0 \
    -e FIRMWARE_URL=https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_3.x.0/bin/CC1352P2_CC2652P_launchpad_coordinator_20230507.zip \
    ckware/ti-cc-tool -ewv -p /dev/ttyUSB0 --bootloader-sonoff-usb

Configuration

Home Assistant

Test configuration

docker exec homeassistant hass --config /config --script check_config
docker exec homeassistant hass --config /config --script check_config --secrets

Frigate

Optimizing performance

Gathering information
vainfo --display drm --device /dev/dri/renderD128
ffmpeg -decoders | grep qsv
ffmpeg -hwaccels
Ansible variables
# AMD GPU
homeassistant_frigate_env:
    LIBVA_DRIVER_NAME: radeonsi

# Intel CPU
homeassistant_frigate_env:
    LIBVA_DRIVER_NAME: i965
Monitor GPU usage
sudo apt install intel-gpu-tools radeontop
sudo intel_gpu_top
sudo radeontop

Nginx

ansible-role-letsencrypt-nginx variables:

# Given:
#homeassistant_port: 8080
#homeassistant_frigate_port: 8081

letsencryptnginx_websites:
  - domain: ha.example.com
    proxy_port: 8080
    websocket_path: /api/websocket
  - domain: frigate.example.com
    proxy_port: 8081
    websocket_enabled: true

HACS installation

docker exec -ti homeassistant \
    bash -c 'wget -O - https://get.hacs.xyz | bash -'

Troubleshooting

iRobot Roomba J7 cloud password

Get the cloud password (authn/z token):

docker run -it node sh -c "npm install -g dorita980 && get-roomba-password-cloud ${websiteEmail} ${websitePassword}

Sensi Thermostat HomeKit

  1. Reset the thermostat to factory settings
  2. Begin the thermostat setup process via the Sensi app
  3. Prior to configuring WIFI, the thermostat will display a pairing code - take note of this.
  4. Continue with the setup process via the Sensi app, but switch to Home Assistant once you've connected the thermostat to WIFI
  5. Home Assistant should now detect a new HomeKit device, which you should begin configuring
  6. When prompted for a "pairing code", enter the code noted above, and then complete the setup procedure
  7. Complete the Sensi app setup procedure

Upgrade, downgrade or pin a component's dependencies

Eg. Pin pyenvisalink to version 4.0 to workaround this issue.

docker exec -ti homeassistant \
    bash -c "find /usr/src/homeassistant/ \
    -name 'requirements*.txt' -or -name manifest.json \
    | xargs grep -l pyenvisalink \
    | xargs sed -i 's/pyenvisalink==[a-zA-Z0-9.]\+/pyenvisalink==4.0/g'"

Or upgrade the offending dependency directly as in these Ansible tasks:

- name: "Install pexpect from the 'master' branch. Workaround 1/2 for: https://github.com/home-assistant/core/issues/94264"
  community.docker.docker_container_exec:
    container: homeassistant
    argv:
      - /bin/bash
      - "-c"
      - "pip install https://github.com/pexpect/pexpect/archive/master.zip"

- name: "Restart the homeassistant container. Workaround 2/2 for: https://github.com/home-assistant/core/issues/94264"
  community.docker.docker_container:
    name: homeassistant
    state: started
    restart: true

Coral.ai doesn't work

docker logs frigate shows an error:

ValueError: Failed to load delegate from libedgetpu.so.1.0

Try rebooting the host OS or restarting the Docker container.

When debugging, note that when a Coral.ai USB adpater is first connected its manufacturer is listed as "Global Unichip Corp", but then it changes to "Google Inc." after its first inference, so look for both manufacturer names: lsusb | grep -E 'Global|Google'

Excerpt from dmesg:

[  303.677695] usb 3-2: new high-speed USB device number 22 using xhci_hcd
[  303.827453] usb 3-2: New USB device found, idVendor=1a6e, idProduct=089a, bcdDevice= 1.00
[  303.827457] usb 3-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[  334.017843] usb 3-2: reset high-speed USB device number 22 using xhci_hcd
[  336.329848] usb 3-2: reset high-speed USB device number 22 using xhci_hcd
[  336.478836] usb 3-2: device firmware changed
[  336.478857] usb 3-2: USB disconnect, device number 22
[  336.606068] usb 3-2: new high-speed USB device number 23 using xhci_hcd
[  336.755606] usb 3-2: New USB device found, idVendor=18d1, idProduct=9302, bcdDevice= 1.00
[  336.755611] usb 3-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0

Documentation and resources

Custom cards

Integrations

Custom integrations

About

An Ansible role that provisions Home Assistant, Frigate, and Mosquitto Docker containers

Topics

Resources

License

Stars

Watchers

Forks

Languages