I’ve got Docker running on a RPi3 with Homeassistant and I need to get a python module installed to connect my Air Conditioning unit (https://github.com/sampsyo/wideq). THe module is not on PIP so i need to install manually with -e.
From what I can see a dockerfile with the lines below will do this however I’m not sure how to install/run as part of my docker-compose to build the image. Has anyone done similar? are there any guides I can follow on this?
FROM homeassistant/raspberrypi3-homeassistant:latest
RUN pip3 install -e /opt/wideq
If you put your Dockerfile in the same directory as your docker-compose.yaml and then replace the image: line with build: . you can build with docker-compose build and run as normal.
Thanks - I’ve made some progress however it isn’t working for me yet
I’ve created a dockerfile and built with the following command: docker build -t ha-custom .
Dockerfile:
FROM homeassistant/raspberrypi3-homeassistant:latest
RUN pip install --upgrade pip
RUN wget https://github.com/sampsyo/wideq/archive/master.zip && unzip master.zip && cd wideq-master && pip3 install -e .
There is probably a smarter way to download and install the python module however I got this successfully build the image, when i run it the python module is still not found by HA when I try and load the custom component. I feel like there is maybe a scope issue with my logic here.
I’m launching it from docker-compose with the following configuration.
I am not a developer, but I am under the impression that if you declare a python module a dependency inside the custom component it will be installed at first boot.
pip3 can download and install a zip file, so the Dockerfile can be simplified to
FROM homeassistant/home-assistant
RUN pip3 install https://github.com/sampsyo/wideq/archive/master.zip
I’m testing this on an ubuntu machine, so I have a different base, but it should work on the Pi version.
Running this seems to have wideq installed, so I’m not sure what else the problem would be.
graham@naos-kde:~
$ docker exec -it homeassistant python3
Python 3.6.7 (default, Nov 16 2018, 22:33:19)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wideq
>>>