PatrickE94 / pycalima

Python interface for Pax Calima Fan via Bluetooth LE
Apache License 2.0
43 stars 22 forks source link

Run this in a container? #15

Closed Nornode closed 4 years ago

Nornode commented 4 years ago

Has anyone managed to run this in a container (e.g. custom baked Homeassitant / Node-red)?

I have been trying to get Bluetooth and pycalima working however I'm getting permission errors (probably not a pycalima issue) but thought if someone are already running this in a container it would save me many hours of troubleshooting.

I can't wait to get my fan into Home Assistant! Thanks!

PatrickE94 commented 4 years ago

Not much for containers, running a few for applications I want isolated. I think there's loads of resources on getting Bluetooth supported in containers of Hass. However, I don't myself. If anyone else wants to chime in please do so! This is useful and related information!

Nornode commented 4 years ago

OK, thanks! I got it running in my self-baked node-red image that pulls your repo and makes it available inside the container.

Let me know if there's interest to publish this for the public.

asifma commented 3 years ago

OK, thanks! I got it running in my self-baked node-red image that pulls your repo and makes it available inside the container.

Let me know if there's interest to publish this for the public.

Im very interested :), im running Home Assistant (Supervisor) with Node-Red

Nornode commented 3 years ago

This is the docker file I used to make the container

FROM nodered/node-red:1.0.6-2-12-minimal-arm32v6

USER root

#RUN /bin/sh -c apk add --no-cachel glib-dev
RUN apk add glib-dev

RUN echo "**** install Python ****" && \
    apk add --no-cache python3

# Dependencies
RUN apk add \
  --no-cache \
  #-- virtual \
  --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
  --repository http://dl-cdn.alpinelinux.org/alpine/edge/main

#RUN apk add glib-dev

#RUN apk add --no-cache python3-pip libglib2.0-dev

RUN if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi

RUN echo "**** install pip ****" && \
    python3 -m ensurepip && \
    rm -r /usr/lib/python*/ensurepip

RUN pip3 install --no-cache --upgrade pip setuptools wheel && \
    if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi

#RUN pip3 -v install bluepy
RUN git clone https://github.com/IanHarvey/bluepy.git /usr/bluepy
RUN apk add make g++
RUN pip3 install git+https://github.com/IanHarvey/bluepy.git
#& cd bluepy && python setup.py build && sudo python setup.py install

RUN git clone https://github.com/PatrickE94/pycalima.git /usr/pycalima
RUN pip3 install git+https://github.com/PatrickE94/pycalima.git

# User configuration directory volume
VOLUME ["/data"]
EXPOSE 1880

# Environment variable holding file path for flows configuration
ENV FLOWS=flows.json

CMD ["npm", "start", "--", "--userDir", "/data"]