Use HM-CFG-USB2 fob and emulate a HM-CFG-LAN. Compiled for a bunch of platforms. One for all!
1.5K
The adapter HM-CFG-USB-2 was a popular choice for home automation. After years of use, hardware has changed. Fortunately it was possible to use the adapter for quite some time as Michael Gernoth (https://www.gernoth.net/michael/) provided an interface to use the fob for other home automation systems. As this requires recompiling the software for the specific systems, I decided to create a Docker container with my colleague Volker R.
The main credits need to go to the creator of https://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb All the brain work is coming from there!
FROM alpine:3 as build
LABEL org.opencontainers.image.authors="Boris W."
ENV HMCFGUSB_VERSION 0.103
ENV S6_VERSION 3.1.6.2
ENV S6_ARCH x86_64
ARG TARGETARCH
ARG TARGETVARIANT
WORKDIR /app
RUN apk update \
&& apk upgrade \
&& apk add --no-cache --update build-base libusb-dev git xz wget \
&& case "${TARGETARCH}" in \
amd64) S6_ARCH="x86_64" ;; \
arm64) S6_ARCH="aarch64" ;; \
386) S6_ARCH="i686" ;; \
arm) \
case "${TARGETVARIANT}" in \
v6) S6_ARCH="armhf" ;; \
v7) S6_ARCH="arm" ;; \
esac ;; \
*) echo "Unsupported architecture: ${TARGETARCH}"; exit 1 ;; \
esac \
&& wget https://git.zerfleddert.de/hmcfgusb/releases/hmcfgusb-$HMCFGUSB_VERSION.tar.gz -P /app \
&& wget https://github.com/just-containers/s6-overlay/releases/download/v$S6_VERSION/s6-overlay-noarch.tar.xz -P /tmp \
&& wget https://github.com/just-containers/s6-overlay/releases/download/v$S6_VERSION/s6-overlay-$S6_ARCH.tar.xz -P /tmp \
&& tar zxf hmcfgusb-$HMCFGUSB_VERSION.tar.gz \
&& rm hmcfgusb-$HMCFGUSB_VERSION.tar.gz \
&& cd hmcfgusb-$HMCFGUSB_VERSION \
&& make \
&& mkdir /app/compiled \
&& mv flash-hmcfgusb ../compiled \
&& mv flash-hmmoduart ../compiled \
&& mv flash-ota ../compiled \
&& mv hmland ../compiled \
&& mv hmsniff ../compiled \
&& mv reset-hmmoduart.sh ../compiled \
&& cd .. \
&& rm -rf ./hmcfgusb-$HMCFGUSB_VERSION \
&& mkdir /app/s6overlay \
&& tar -C /app/s6overlay -Jxpf /tmp/s6-overlay-noarch.tar.xz \
&& tar -C /app/s6overlay -Jxpf /tmp/s6-overlay-$S6_ARCH.tar.xz
FROM alpine:3
COPY --from=build /app/compiled /app
COPY --from=build /app/s6overlay /
RUN apk update \
&& apk upgrade \
&& apk add --no-cache --update libusb \
&& mkdir /etc/s6-overlay/s6-rc.d/hmland \
&& mkdir /etc/s6-overlay/s6-rc.d/user/contents.d/hmland \
&& echo "longrun" > /etc/s6-overlay/s6-rc.d/hmland/type \
&& echo "#!/command/execlineb -P" > /etc/s6-overlay/s6-rc.d/hmland/run \
&& echo "/app/hmland -p 1000 -i" >> /etc/s6-overlay/s6-rc.d/hmland/run \
&& cd /etc/s6-overlay/s6-rc.d/user/contents.d \
&& touch hmland \
&& mkdir /etc/s6-overlay/s6-rc.d/hmland/dependencies.d/ \
&& cd /etc/s6-overlay/s6-rc.d/hmland/dependencies.d/ \
&& touch base
EXPOSE 1000
ENTRYPOINT ["/init"]
The container is using s6 overlay for staying alive. When building make sure to set the build args (buildx should already make sure it's setting the target arch and variant). It will clone the repository from zerfleddert.de and build it. Also it will download the (as of now) current version of s6 overlay. As this is a multi staged build, the image should be fairly small.
As this is using a USB device, make sure to run the container in privileged mode! You can always try to map the stick directly but this is not supported by me.
docker run --name hmland --privileged -p 1000:1000 boriswde/hmland:latest
version: '3'
services:
hmland:
container_name: hmland
hostname: hmland
image: "boriswde/hmland:latest"
restart: unless-stopped
privileged: true # for discovering stick
stop_grace_period: 1m
ports:
- "1000:1000"
Content type
Image
Digest
sha256:e65f181b8…
Size
7.7 MB
Last updated
over 2 years ago
docker pull boriswde/hmland