I am attempting to move from an unsupported raspbian core installation to a supported version using the supervisor. A remaining obstacle is that I use an Alarm Decoder device that doesn’t work reliably with the serial connection – thus I need the ser2sock service running.
Luckily, this has been addressed in the past. An older container was developed and is available at this location: original hassio addon
Based on the latest dev guidelines for addons, I made modifications and can get this addon built and running on a new supervisor/HA install. I believe I need permissions added as well but this is where my non-existent experience with docker containers is evident. The addon needs access to the serial device, i.e. /dev/ttyUSB0, and home assistant needs to connect to it on the specified socket port.
Any ideas on modifications to allow this addon to function? The example for allowing a port specifies something like 22/tcp, but this is a socket so I’m guessing tcp isn’t correct and I’m unsure how to allow this. Thanks in advance!
EDIT: config.json modified to add the fixed code from post #2.
config.json:
{
"name": "AlarmDecoder ser2sock",
"version": "1.0.0",
"slug": "ser2sock",
"description": "Implementation of ser2sock for Home Assistant, custom modified.",
"url": "https://github.com/goyney/hassio-addon-ser2sock/",
"startup": "services",
"boot": "auto",
"auto_uart": true,
"ports": {
"10000/tcp": 10000
},
"ports_description": {
"10000/tcp": "ser2sock socket port"
},
"devices": [
"/dev/ttyUSB0"
],
"options": {
"serialDevice": "/dev/ttyUSB0",
"baudRate": 115200,
"port": 10000
},
"schema": {
"serialDevice": "str",
"baudRate": "int",
"port": "port"
},
"arch": ["amd64", "armv7", "armhf", "i386" , "aarch64"]
}
Dockerfile:
ARG BUILD_FROM=homeassistant/amd64-base:latest
FROM $BUILD_FROM
ENV LANG C.UTF-8
# Build and install the ser2sock application
RUN \
apk add --no-cache build-base git openssl-dev jq && \
cd /tmp && \
git clone https://github.com/nutechsoftware/ser2sock.git && \
cd ser2sock && \
./configure && \
make && \
cp ser2sock /usr/local/bin/ && \
cp -R etc/ser2sock /etc/ && \
cd .. && \
rm -rf ser2sock
WORKDIR /
# Copy run script
COPY run.sh /app/start.sh
COPY ser2sock.conf /etc/
RUN chmod a+x /app/start.sh
ENTRYPOINT ["/app/start.sh"]
LABEL io.hass.version="VERSION" io.hass.type="addon" io.hass.arch="armhf|aarch64|i386|amd64"