Discussion - Adding Home Assistant to PlexGuide | PlexGuide.com

Discussion Adding Home Assistant to PlexGuide

  • Stop using Chrome! Download the Brave Browser via >>> [Brave.com]
    It's a forked version of Chrome with native ad-blockers and Google's spyware stripped out! Download for Mac, Windows, Android, and Linux!
Welcome to the PlexGuide.com
Serving the Community since 2016!
Register Now

ryanjohnson

Citizen
Original poster
Sep 28, 2018
9
8
Home Assistant is a very well developed home automation application that has been around for some time now. Currently I am deploying it alongside PlexGuide and having it use traefik for SSL access. I was wondering if it would be possible it add this to the PG Apps in the future? The only thing that I am having to do to set it up properly is deploying the Home Assistant docker image on the host network in order for certain components to function properly (HomeKit access for iPhones, specifically), and then I'm having to change traefik to the host network as well. I'm sure there's an easier way to accomplish this but this is the method I've been using for a couple months and I haven't had any issues.


Here is my current docker command to set it up:

sudo docker run -d \
--name="home-assistant" \
-v /opt/appdata/homeassistant:/config \
-v /etc/localtime:/etc/localtime:ro \
-l traefik.enable=true \
-l traefik.frontend.redirect.entryPoint=https \
-l traefik.frontend.rule=Host:home.yourdomain.com, \
-l traefik.port=8123 \
--net=host \
homeassistant/home-assistant
 
  • Like
Reactions: 1 users

Admin9705

Administrator
Project Manager
Donor
Jan 17, 2018
5,156
2,112
Can add
 

shmookles

Active
Dec 30, 2018
34
1
@ryanjohnson I'm having trouble mapping my Zwave USB stick to the home-assistant running in PG. any ideas on how to make it work? I already modified the the home-assistant.yml file to reflect the:

Code:
devices:
          - '/dev/ttyACM0:/dev/ttyACM0:rwm'
 

ryanjohnson

Citizen
Original poster
Sep 28, 2018
9
8
@ryanjohnson I'm having trouble mapping my Zwave USB stick to the home-assistant running in PG. any ideas on how to make it work? I already modified the the home-assistant.yml file to reflect the:

Code:
devices:
          - '/dev/ttyACM0:/dev/ttyACM0:rwm'
So my setup of things is a little unorthodox, and the only way I've reached full functionality in Home Assistant is to redeploy the container with host network privileges (necessary for discovery and homekit functionality), and also for devices to work I run the container in privileged mode. This takes about 2 minutes in Portainer, however by taking is off the plexguide network it loses traefik support. The way I've gotten around this is by running traefik on the host network as well, so that way all containers will have traefik support. This all stable for my uses, however it does break the pgshield (oauth) support, so if you use that then you're going to have a bad time. I have not had any luck modifying the traefik config to support host containers, I can only have it work by running the traefik container as a host.
 

craigenator

Citizen
Oct 15, 2018
3
0
Anyone ever figure out a way to map a device into home-assistant using PGBlitz? I've got a Z-stick mapped to my Linux VM however I'm not sure where I should be exposing the device. In naked docker I'd do something like a docker run --devices /dev/zwave:/dev/zwave ... or could do it using a docker-compose file however I'd like to keep the automation of PGblitz in tact. Any idea where this modification to the home-assistant container could be most effectively done?
 

ryanjohnson

Citizen
Original poster
Sep 28, 2018
9
8
I highly recommend using Portainer where you can edit the container's Runtime & Resources settings to easily map the device. The only issue here is that this is not a persistent fix and will be reset if you ever update the container through PGupdate. Alternatively, you can create your own Home Assistant app and install it through the pg command as you would the provided app, however this time it would just be reading from your custom app folder. The following template would connect the device at /dev/ttyUSB0 to the Home Assistant container. You can change this to fit the exact mapping to your Z Wave USB stick

Code:
#!/bin/bash
#
# Title:      PlexGuide (Reference Title File)
# Author(s):  Admin9705
# URL:        https://plexguide.com - http://github.plexguide.com
# GNU:        General Public License v3.0
################################################################################
---
- hosts: localhost
  gather_facts: false
  tasks:
    # FACTS #######################################################################
    - name: 'Set Known Facts'
      set_fact:
        pgrole: 'home-assistant'
        intport: '8123'
        extport: '8123'
        image: 'homeassistant/home-assistant'

    # CORE (MANDATORY) ############################################################
    - name: 'Including cron job'
      include_tasks: '/opt/communityapps/apps/_core.yml'

    # LABELS ######################################################################
    - name: 'Adding Traefik'
      set_fact:
        pg_labels:
          traefik.frontend.auth.forward.address: '{{gauth}}'
          traefik.enable: 'true'
          traefik.port: '{{intport}}'
          traefik.frontend.rule: 'Host:home.{{domain.stdout}},{{pgrole}}.{{domain.stdout}},{{tldset}}'

    - name: 'Setting PG Volumes'
      set_fact:
        pg_volumes:
          - '/etc/localtime:/etc/localtime:ro'
          - '/opt/appdata/homeassistant:/config'

    - name: 'Setting PG ENV'
      set_fact:
        pg_env:
          PUID: '1000'
          PGID: '1000'

    # MAIN DEPLOYMENT #############################################################
    - name: 'Deploying {{pgrole}}'
      docker_container:
        name: '{{pgrole}}'
        image: '{{image}}'
        pull: yes
        published_ports:
          - '{{ports.stdout}}{{extport}}:{{intport}}'
        volumes: '{{pg_volumes}}'
        env: '{{pg_env}}'
        restart_policy: unless-stopped
        devices:
          - /dev/ttyUSB0:/dev/ttyUSB0
        networks:
          - name: plexguide
            aliases:
              - '{{pgrole}}'
        state: started
        labels: '{{pg_labels}}'
 
  • Like
Reactions: 1 user

Recommend NewsGroups

      Up To a 58% Discount!

Trending