Docker template for Home Assistant - Python 3 home automation


Recommended Posts

Hi,

 

I have two questions regarding this docker:

 

1) Where can I store custom components? On an RPi Installation I can create a folder "custom_components" in the home directory of home-assistant

 

2) If I need pip3 packages: do I need to install them on the base unraid system or within the docker?

 

Br,

Johannes

 

Ok, It seems I was able to figure it out by try-and-error:

 

1) custom_components: placed them in the appdata-folder of the app

2) pip3 packages installed as user root

Edited by ebnerjoh
Link to comment

Ok, still struggeling with one component (BLNET for Home Assistant).

 

If I start home assistant I am getting the following error:

2018-05-10 08:20:46 ERROR (SyncWorker_4) [homeassistant.util.package] Unable to install package pyblnet==0.4.2: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-goivl1cr/html/
2018-05-10 08:20:46 ERROR (MainThread) [homeassistant.requirements] Not initializing blnet because could not install requirement pyblnet==0.4.2
2018-05-10 08:20:46 ERROR (MainThread) [homeassistant.setup] Setup failed for blnet: Could not install all requirements.

 

I have installed html and pyblnet via pip3:

root@UnRaid:/mnt/user/appdata# pip3 install html==1.0
Requirement already satisfied: html==1.0 in /usr/lib64/python3.6/site-packages

root@UnRaid:/mnt/user/appdata# pip3 install pyblnet==0.4.2
Requirement already satisfied: pyblnet==0.4.2 in /usr/lib64/python3.6/site-packages
Requirement already satisfied: requests in /usr/lib64/python3.6/site-packages (from pyblnet==0.4.2)
Requirement already satisfied: htmldom in /usr/lib64/python3.6/site-packages (from pyblnet==0.4.2)
Requirement already satisfied: html in /usr/lib64/python3.6/site-packages (from pyblnet==0.4.2)
Requirement already satisfied: idna<2.7,>=2.5 in /usr/lib64/python3.6/site-packages (from requests->pyblnet==0.4.2)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib64/python3.6/site-packages (from requests->pyblnet==0.4.2)
Requirement already satisfied: certifi>=2017.4.17 in /usr/lib64/python3.6/site-packages (from requests->pyblnet==0.4.2)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/lib64/python3.6/site-packages (from requests->pyblnet==0.4.2)

 

Link to comment

@balloob: Do you have an idea in my issue?

 

I think I may need to install the PyBLNET within the docker, but I do not know how to do.

 

If I run pip3 install PyBLNET within the Docker, then I am getting the following error:

 

r

root@UnRaid:/usr/src/app# pip install PyBLNET==0.4.2
Collecting PyBLNET==0.4.2
  Using cached https://files.pythonhosted.org/packages/73/72/668f8ab18ed0291bd89430bc39784ffd19ffa0cacbc5dda30151b1a627bf/PyBLNET-0.4.2-py2.py3-none-any.whl
Collecting html (from PyBLNET==0.4.2)
  Using cached https://files.pythonhosted.org/packages/4a/df/0e3d22d50ee43274eb5116f49972a164d853bb3ab305a69a0540b6292252/html-1.16.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 14, in <module>
        from setuptools.dist import Distribution, Feature
      File "/usr/local/lib/python3.6/site-packages/setuptools/dist.py", line 24, in <module>
        from setuptools.depends import Require
      File "/usr/local/lib/python3.6/site-packages/setuptools/depends.py", line 7, in <module>
        from .py33compat import Bytecode
      File "/usr/local/lib/python3.6/site-packages/setuptools/py33compat.py", line 11, in <module>
        from setuptools.extern.six.moves import html_parser
      File "/usr/local/lib/python3.6/site-packages/setuptools/_vendor/six.py", line 92, in __get__
        result = self._resolve()
      File "/usr/local/lib/python3.6/site-packages/setuptools/_vendor/six.py", line 115, in _resolve
        return _import_module(self.mod)
      File "/usr/local/lib/python3.6/site-packages/setuptools/_vendor/six.py", line 82, in _import_module
        __import__(name)
    ModuleNotFoundError: No module named 'html.parser'; 'html' is not a package

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-rzjxgfdy/html/

Best Regards,

Johannes

Link to comment
  • 3 weeks later...

Thanks to this thread and container I'm hooked on HomeAssistant.  I've been adding quite a few containers to my war chest of containers.  After testing several for a while and getting the hang of making my own templates I've decided to share the work back to make is easy on the folks using things.  I'll be adding the MQTT Smartthings one soon as I myself were looking for this one in the thread.  I do have the TasmoAdmin and HA-Dockermon templates going up soon if not already.  

 

 

Link to comment
  • 2 weeks later...

Hi,

 

I need to move my Z-Wave stick away from my unRaid server more centrally (with an Raspberry Pi). This should be possible with ser2net (on PI) and socat (on the HA Server).

 

Unfortunatly I have not seen any solution for Socat on Unraid, but I saw that there are dockers available with HomeAssistant + Socat:

 

https://github.com/vladbabii/homeassistant-socat

 

Any chance to get such a thing to the unRaid Docker?

 

Br,

Johannes

Link to comment
1 hour ago, ebnerjoh said:

Hi,

 

I need to move my Z-Wave stick away from my unRaid server more centrally (with an Raspberry Pi). This should be possible with ser2net (on PI) and socat (on the HA Server).

 

Unfortunatly I have not seen any solution for Socat on Unraid, but I saw that there are dockers available with HomeAssistant + Socat:

 

https://github.com/vladbabii/homeassistant-socat

 

Any chance to get such a thing to the unRaid Docker?

 

Br,

Johannes

 

Why not run everything on the Raspberry pi then? Or just buy an Z-wave Extender if it's the signal strength that is your issue. 

Link to comment
8 minutes ago, saarg said:

 

Why not run everything on the Raspberry pi then? Or just buy an Z-wave Extender if it's the signal strength that is your issue. 

 

I want to run as less as possible on the RPi, therefore I have the unraid server ?

 

With the range extenders I had no good experience, for me the wall plugs are working better in terms of signal repeating, but also for them I would need additional 4 to 5 devices to setup a proper coverage. 

 

Br,

Johannes

Link to comment
2 hours ago, ebnerjoh said:

 

I want to run as less as possible on the RPi, therefore I have the unraid server ?

 

With the range extenders I had no good experience, for me the wall plugs are working better in terms of signal repeating, but also for them I would need additional 4 to 5 devices to setup a proper coverage. 

 

Br,

Johannes

 

But if you already run the rpi, then why not also HA? Cheaper than buying many wallplug. 

You have a really big house or concrete walls? 

Edited by saarg
Link to comment
  • 3 months later...

My HA container started acting weird after one of the recent updates.  I have it so I can access it through nginix and letsencrypt as detailed by SpaceInvaderOne.  For some reason the Port Mapping and port config went missing:

 

image.png.acba89d4fc6d7d9663fdf4d9c36987e7.png

 

image.thumb.png.5ab6e3b849dc9e11f76538a47dd77cb2.png

image.png.e13b1775955ce61abc931b5b88597e5f.png

 

 

The other containers in the "proxynet" network, NodeRed & Bitwarden, are working as intended.  

 

I've tried uninstalling, removing, re-installing the HA container multiple times.  Any ideas?

 

 

Edited by kimocal
image update
Link to comment
  • 1 month later...
On 10/9/2018 at 10:56 PM, kimocal said:

My HA container started acting weird after one of the recent updates.  I have it so I can access it through nginix and letsencrypt as detailed by SpaceInvaderOne.  For some reason the Port Mapping and port config went missing:

 

image.png.acba89d4fc6d7d9663fdf4d9c36987e7.png

 

image.thumb.png.5ab6e3b849dc9e11f76538a47dd77cb2.png

image.png.e13b1775955ce61abc931b5b88597e5f.png

 

 

The other containers in the "proxynet" network, NodeRed & Bitwarden, are working as intended.  

 

I've tried uninstalling, removing, re-installing the HA container multiple times.  Any ideas?

 

 

I have this same problem

Link to comment
  • 1 month later...
  • 2 months later...

Hello,

 

I have Home-Assistant running on my unraid server.

Working fine! I do have a question. To be honnest, i'm not sure this is related to this docker or home-assistant.

I try to include some custome node.js files in my lovelace config. It does not seem to work...

Do I have to modify something in the docker config?

 

See my lovelace config below...

background: center / auto repeat url("/local/surfgirl.png") fixed
resources:
  - type: module
    url: /local/mini-media-player-bundle.js
  - type: js
    url: /local/clock-card.js
  - type: js
    url: /local/moment.js
  - type: js
    url: /local/slider-entity-row.js
  - type: js
    url: /local/card-tools.js
  - type: js
    url: /local/card-modder.js
  - type: module
    url: /local/button-card.js
title: Résidence Famille Guénette
views:
  - badges:
      - sun.sun
    cards:
      - entity: weather.dark_sky
        name: Météo
        type: weather-forecast
      - entities:
          - entity: light.chambre_maitre
          - entity: light.wall_switch_1
            name: Extérieur Avant
          - entity: light.wall_switch_2
            name: Extérieur Arrière
          - entity: light.veranda
        show_header_toggle: false
        title: Lumières
        type: entities
      - entities:
          - entity: switch.borne
          - entity: switch.cuisiniere
        show_header_toggle: false
        title: SonOff Borne / Cuisinière
        type: entities
      - entities:
          - entity: input_boolean.borne_tesla
          - entity: input_boolean.cuisiniere
          - entity: input_boolean.max_home
          - entity: input_boolean.nad_home
          - entity: input_boolean.siri_aurevoir
          - entity: input_boolean.siri_bonjour
          - entity: input_boolean.siri_nuit
        show_header_toggle: false
        title: Boolean
        type: entities
      - default_zoom: 10
        entities:
          - entity: device_tracker.max_iphone
        title: Location
        type: map
      - entity: media_player.cuisine_salon
        type: media-control
      - entity: input_boolean.borne_tesla
        hold_action:
          action: none
        tap_action:
          action: toggle
        theme: palms
        type: entity-button
    path: default_view
    title: Home
  - badges: []
    cards:
      - entity: alarm_control_panel.home_alarm
        name: Système d’alarme
        states:
          - arm_home
          - arm_away
        type: alarm-panel
    icon: ''
    title: Alarme

So, when I try to add a custom component, I have this error (see attached picture).

 

Any idea?

 

Tks!

 

Max

 

2019-03-18 14_19_06-Home Assistant.png

Link to comment
  • 6 months later...

Just FYI what I discovered as I switched from HASS in a VM to just the main container using a fixed IP in bridge mode:

1) HASS removed the docker port mapping, so Unraid will not show ports, and the web UI link will not work. I could not find a way to make Unraid do explicit port mappings or how to make the web ui link work, e.g. like I would manually do using docker compose when adding ports.

2) HASS runs as root, workaround is to use this solution, such that appdata permissions work as expected. Copy the run script to appdata folder and add execute permissions (or git clone and copy run file to correct folder). Edit docker config in advanced mode and add "--user 99:100" in extra parameters section. Add env UMASK and set value to 007. Make sure all config files in appdata are deleted, other than run, start container, and permissions will be correct.

Hope this help somebody.

Link to comment
20 minutes ago, ptr727 said:

I could not find a way to make Unraid do explicit port mappings

You won't.  As soon as an app is on its own separate IP address, all port mappings are meaningless as the container will utilize whatever ports that it chooses (ie: the default ones)

23 minutes ago, ptr727 said:

how to make the web ui link work,

IIRC there is an issue with the webUI entry when using an app on it's own IP.  Either bookmark the appropriate URL in your browser, or try enabling authoring mode in settings - docker (you have to stop the service first), and explicitly specify the appropriate URL in the webUI entry (advanced view)

Link to comment
3 hours ago, Squid said:

You won't.  As soon as an app is on its own separate IP address, all port mappings are meaningless as the container will utilize whatever ports that it chooses (ie: the default ones)

IIRC there is an issue with the webUI entry when using an app on it's own IP.  Either bookmark the appropriate URL in your browser, or try enabling authoring mode in settings - docker (you have to stop the service first), and explicitly specify the appropriate URL in the webUI entry (advanced view)

Yep, I understand the meaninglessness of mapping ports in bridge mode, but without it the web UI link does not work.

Of all my containers running in bridge mode, home assistant is the only container where the launch web ui link does not appear.

Most other other containers do list port mappings such that they work correctly in host or bridge mode.

Would be great if the web ui link always works, maybe use port mapping, or use IP address assigned in bridge setup.

Link to comment
  • 2 months later...

I'm looking to start dabbling into home automation and I'm probably going to need a bit of hand holding, @balloob are you still maintaining things here? It seems there have been quite a few questions and people helping each other out, but that you've gone a bit silent. I'm not blaming you - taking on the support role is a huge commitment, I'm just wondering if you're still around.

Link to comment
  • 2 months later...

I have Home Assistant docker installed.

image.png.484d3bb80df3afe8730c479338858662.png

 

I noticed that when I go to the webgui, it now shows it's deprecated.

image.png.9569768d74d097670217ab3432f1d7c0.png

when I click on the button, i get

image.png.8d6838c60724df6809479624e6b01d94.png

 

I read something about lovelace being the new ui.  

https://www.home-assistant.io/blog/2019/01/23/lovelace-released/

 

When I search in unraid Apps for home assistant, I get the following

image.thumb.png.528e8ef10522e11943fbf70a406d0dc7.png

 

So is this docker going to be updated, or should I remove the docker I have installed and install the above Control Panel or Core dockers?

 

Just trying to figure out how to get the on latest docker for Home Assistant.  I don't like the Deprecated flag, as that means this version should be replced.

 

Thanks!

Link to comment
  • 1 year later...

Hi,

I have Home Assistant Core running in a docker container in Unraid. I'm trying to install a custom component by creating a "custom_components" folder in the main directory of the container (...appdata\Home-Assistant-Core\) and then copying the appropriate files here.

My problem is that I don't know how to manipulate the file system of the docker container. I can view it in the Unraid web interface but I'm not sure the best way to create a folder or copy a file over from my desktop. I'm sure this is simple but I'm somewhat new to Unraid. Could somebody please recommend an approach that I can look into further?

Thanks!

Edited by Kiefer
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.