Add-on for OCCU (#209)

* Create Dockerfile

* Create config.json

* Update config.json

* Update Dockerfile

* Create run.sh

* Create build.json

* Update config.json

* Update config.json

* Update config.json

* Create rfd.conf

* Update Dockerfile

* Update run.sh

* Update run.sh

* Update run.sh

* Update Dockerfile

* Update run.sh

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update Dockerfile

* Update run.sh

* Update run.sh

* Update run.sh

* Update run.sh

* Update rfd.conf

* Update run.sh

* Update run.sh

* Update config.json

* Update Dockerfile

* Update run.sh

* Update run.sh

* Update Dockerfile

* Update rfd.conf

* Update run.sh

* Update rfd.conf

* Update config.json

* Update run.sh

* Update Dockerfile

* Update Dockerfile

* Update build.json

* Update run.sh

* Update config.json

* Update Dockerfile

* Update Dockerfile

* Update config.json

* Update Dockerfile

* Update Dockerfile

* Add files via upload
This commit is contained in:
Pascal Vizeli
2017-12-14 23:41:29 +01:00
committed by GitHub
parent 0a04b2b9e4
commit 9cbc42553c
6 changed files with 121 additions and 0 deletions

38
homematic/Dockerfile Normal file
View File

@@ -0,0 +1,38 @@
ARG BUILD_FROM
FROM $BUILD_FROM
# Install packages
RUN apt-get update \
&& apt-get install -y \
curl \
jq \
libusb-1.0 \
&& rm -rf /var/lib/apt/lists/*
ARG OCCU_VERSION
ARG BUILD_ARCH
# Install OCCU
WORKDIR /usr/src
RUN curl -L -o occu.tar.gz https://github.com/eq-3/occu/archive/${OCCU_VERSION}.tar.gz \
&& tar xzpf occu.tar.gz \
&& rm -f occu.tar.gz \
&& cd occu-${OCCU_VERSION} \
&& if [ "${BUILD_ARCH}" = "armhf" ]; then cd arm-gnueabihf; else cd X86_32_Debian_Wheezy; fi \
&& mkdir -p /opt/hm \
&& cp -R packages-eQ-3/RFD/* /opt/hm \
&& cp -R packages-eQ-3/LinuxBasis/* /opt/hm \
&& cp -R packages-eQ-3/HS485D/* /opt/hm \
&& ln -s /opt/hm/etc/config /etc/config \
&& cp -r ../firmware /opt/hm/ \
&& rm -rf /usr/src/occu-${OCCU_VERSION}
ENV HM_HOME=/opt/hm LD_LIBRARY_PATH=/opt/hm/lib:${LD_LIBRARY_PATH}
# Update config files
COPY rfd.conf /etc/config
# Setup start script
COPY run.sh /
RUN chmod a+x /run.sh
CMD [ "/run.sh" ]

10
homematic/build.json Normal file
View File

@@ -0,0 +1,10 @@
{
"build_from": {
"armhf": "multiarch/ubuntu-core:armhf-xenial",
"amd64": "multiarch/ubuntu-core:i386-xenial",
"i386": "multiarch/ubuntu-core:i386-xenial"
},
"args": {
"OCCU_VERSION": "2.29.22-1"
}
}

24
homematic/config.json Normal file
View File

@@ -0,0 +1,24 @@
{
"name": "HomeMatic OCCU",
"version": "2.29.22-1-p0",
"slug": "homematic",
"description": "HomeMatic central based on OCCU",
"url": "https://home-assistant.io/addons/homematic/",
"arch": ["armhf", "i386", "amd64"],
"startup": "services",
"boot": "auto",
"auto_uart": true,
"gpio": true,
"ports": {
"2001/tcp": 2001
},
"options": {
"type": "CCU2",
"device": "/dev/ttyAMA0"
},
"schema": {
"type": "match(CCU2)",
"device": "match(^/dev/.*$)"
},
"image": "homeassistant/{arch}-addon-homeassistant"
}

BIN
homematic/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

16
homematic/rfd.conf Normal file
View File

@@ -0,0 +1,16 @@
# TCP Port for XmlRpc connections
Listen Port = 2001
Log Destination = None
Persist Keys = 1
Device Description Dir = /opt/hm/firmware/rftypes
Device Files Dir = /data/rfd
Key File = /data/keys
Address File = /data/ids
Firmware Dir = /opt/hm/firmware
User Firmware Dir = /data/firmware
Replacemap File = /opt/hm/firmware/rftypes/replaceMap/rfReplaceMap.xml
[Interface 0]

33
homematic/run.sh Normal file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
set -e
CONFIG_PATH=/data/options.json
TYPE=$(jq --raw-output ".type" $CONFIG_PATH)
DEVICE=$(jq --raw-output ".device" $CONFIG_PATH)
# Update config
if [ "$TYPE" == "CCU2" ]; then
(
echo "Type = CCU2"
echo "ComPortFile = $DEVICE"
echo "AccessFile = /dev/null"
echo "ResetFile = /sys/class/gpio/gpio18/value"
) >> /etc/config/rfd.conf
fi
# Init folder
mkdir -p /data/firmware
# Init GPIO
if [ ! -d /sys/class/gpio/gpio18 ]; then
echo 18 > /sys/class/gpio/export
sleep 2
fi
if [ "$(cat /sys/class/gpio/gpio18/direction)" != "out" ]; then
echo out > /sys/class/gpio/gpio18/direction
sleep 2
fi
# Run RFID
"$HM_HOME/bin/rfd" -c -l 0 -f /opt/hm/etc/config/rfd.conf