Skip to content

Commit fb7ca3b

Browse files
committed
SomfyProtect2MQTT 2025.2.0
1 parent ffe2065 commit fb7ca3b

File tree

21 files changed

+178
-86
lines changed

21 files changed

+178
-86
lines changed

SomfyProtect2MQTT-2nd-somfy-account/Dockerfile

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,39 @@
11
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile
22
ARG BUILD_FROM
3-
FROM $BUILD_FROM
3+
FROM ${BUILD_FROM}
44
ENV LANG C.UTF-8
55

66
# SomfyProtect2MQTT version
7-
ARG VERSION=2024.9.0
7+
ARG VERSION=2025.2.0
88

9-
# Install required packages
10-
RUN apk add --no-cache py3-pip py3-opencv ffmpeg
11-
RUN pip3 install --no-cache-dir python-json2yaml==0.1.1
9+
# Copy root filesystem
10+
COPY rootfs /
11+
12+
# Setup base
13+
RUN apk update && apk add --no-cache \
14+
build-base \
15+
ffmpeg \
16+
ffmpeg-dev \
17+
libjxl \
18+
libjxl-tools \
19+
libsrtp \
20+
libsrtp-dev \
21+
libvpx \
22+
libvpx-dev \
23+
linux-headers \
24+
opus \
25+
opus-dev \
26+
py3-opencv \
27+
py3-pip \
28+
python3 \
29+
python3-dev \
30+
yq
1231

1332
# Download source and untar
1433
WORKDIR /usr/bin
1534
ADD "https://github.com/Minims/SomfyProtect2MQTT/archive/refs/tags/${VERSION}.tar.gz" ${VERSION}.tar.gz
16-
RUN tar -xvf ${VERSION}.tar.gz
17-
RUN mv /usr/bin/SomfyProtect2MQTT-${VERSION} /usr/bin/SomfyProtect2MQTT
35+
RUN tar -xvf ${VERSION}.tar.gz && mv /usr/bin/SomfyProtect2MQTT-${VERSION} /usr/bin/SomfyProtect2MQTT
1836

1937
# Install python3 requirements
2038
WORKDIR /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt
2139
RUN pip3 install --no-cache-dir -r requirements/addon.txt
22-
23-
# Copy root filesystem
24-
ADD rootfs /
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile
33
build_from:
4-
aarch64: ghcr.io/hassio-addons/base:15.0.5
5-
amd64: ghcr.io/hassio-addons/base:15.0.5
6-
armhf: ghcr.io/hassio-addons/base:15.0.5
7-
armv7: ghcr.io/hassio-addons/base:15.0.5
8-
i386: ghcr.io/hassio-addons/base:15.0.5
4+
aarch64: ghcr.io/hassio-addons/base:17.1.1
5+
amd64: ghcr.io/hassio-addons/base:16.3.6
6+
armhf: ghcr.io/hassio-addons/base:17.1.1
7+
armv7: ghcr.io/hassio-addons/base:17.1.1
8+
i386: ghcr.io/hassio-addons/base:16.3.6
99
labels:
1010
org.opencontainers.image.title: "Home Assistant Add-on: Minims add-on"
1111
org.opencontainers.image.description: "Minims add-on to use as a blueprint for new add-ons."
1212
org.opencontainers.image.source: "https://github.com/Minims/homeassistant-addons"
1313
org.opencontainers.image.licenses: "Apache License 2.0"
1414
args:
15-
VERSION: "2024.9.0"
15+
VERSION: "2025.2.0"

SomfyProtect2MQTT-2nd-somfy-account/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
33
name: SomfyProtect2MQTT - 2nd Somfy Account
4-
version: 2025.1.5
4+
version: 2025.2.0
55
slug: somfy-protect-2-mqtt-2nd-somfy-account
66
description: Publish Somfy Home Alarm as MQTT messages
77
url: https://github.com/Minims/homeassistant-addons/tree/main/SomfyProtect2MQTT
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/command/with-contenv bashio
2+
# shellcheck shell=bash
3+
# ==============================================================================
4+
# Home Assistant SomfyProtect2MQTT Add-on for Home Assistant
5+
# ==============================================================================
6+
declare exit_code
7+
readonly exit_code_container=$(</run/s6-linux-init-container-results/exitcode)
8+
readonly exit_code_service="${1}"
9+
readonly exit_code_signal="${2}"
10+
readonly service="somfyProtect2Mqtt"
11+
12+
bashio::log.info \
13+
"Service ${service} exited with code ${exit_code_service}" \
14+
"(by signal ${exit_code_signal})"
15+
16+
# Received a signal
17+
if [[ "${exit_code_service}" -eq 256 ]]; then
18+
19+
# The signal might be a result of another service crashing. Only
20+
# overwrite the container exit code if it is not already set.
21+
if [[ "${exit_code_container}" -eq 0 ]]; then
22+
echo $((128 + $exit_code_signal)) > /run/s6-linux-init-container-results/exitcode
23+
fi
24+
25+
# If the signal is SIGTERM, we should halt the container and take down
26+
# the whole process tree.
27+
[[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt
28+
29+
# The service exited with a non-zero exit code, which means it crashed.
30+
elif [[ "${exit_code_service}" -ne 0 ]]; then
31+
32+
# The service might be a result of another service crashing. Only
33+
# overwrite the container exit code if it is not already set.
34+
if [[ "${exit_code_container}" -eq 0 ]]; then
35+
echo "${exit_code_service}" > /run/s6-linux-init-container-results/exitcode
36+
fi
37+
38+
# We should halt the container and take down the whole process tree.
39+
exec /run/s6/basedir/bin/halt
40+
41+
# The service exited with a zero exit code, which means it exited, let
42+
# S6 supervision restart it.
43+
else
44+
bashio::log.info "Service ${service} restarting..."
45+
fi

SomfyProtect2MQTT-2nd-somfy-account/rootfs/etc/services.d/SomfyProtect2MQTT/run renamed to SomfyProtect2MQTT-2nd-somfy-account/rootfs/etc/s6-overlay/s6-rc.d/SomfyProtect2MQTT/run

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
#!/usr/bin/with-contenv bashio
1+
#!/command/with-contenv bashio
2+
# shellcheck shell=bash
23
# ==============================================================================
3-
# Start the example service
4-
# s6-overlay docs: https://github.com/just-containers/s6-overlay
4+
# Home Assistant Community Add-on: SomfyProtect2MQTT
5+
# Runs SomfyProtect2MQTT
56
# ==============================================================================
67

7-
# Add your code here
8-
9-
#!/usr/bin/env bashio
10-
118
bashio::log.info "Generating config.yaml from options.json"
129
echo '# Generated by homeassistant, do not edit!' > /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt/config/config.yaml.tmp
1310
echo '# Edit configuration only at the Add-on configuration tab!' >> /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt/config/config.yaml.tmp
14-
json2yaml /data/options.json >> /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt/config/config.yaml.tmp
11+
yq -P -oy /data/options.json >> /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt/config/config.yaml.tmp
1512
sed 's/ -/ -/' /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt/config/config.yaml.tmp > /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt/config/config.yaml
1613
bashio::log.info "Configuration :"
1714
bashio::log.info "$(cat /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt/config/config.yaml)"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
longrun

SomfyProtect2MQTT-2nd-somfy-account/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/SomfyProtect2MQTT

Whitespace-only changes.

SomfyProtect2MQTT-2nd-somfy-account/rootfs/etc/services.d/SomfyProtect2MQTT/finish

Lines changed: 0 additions & 12 deletions
This file was deleted.

SomfyProtect2MQTT-2nd-somfy-account/translations/en.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
configuration:
33
message:
44
name: Message
5-
description: The message that will be printed to the log when starting this example add-on.
5+
description: The message that will be printed to the log when starting this add-on.

SomfyProtect2MQTT-dev/Dockerfile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ENV LANG C.UTF-8
77
COPY rootfs /
88

99
# Setup base
10-
RUN apk add --no-cache \
10+
RUN apk update && apk add --no-cache \
1111
build-base \
1212
ffmpeg \
1313
ffmpeg-dev \
@@ -18,8 +18,6 @@ RUN apk add --no-cache \
1818
libvpx \
1919
libvpx-dev \
2020
linux-headers \
21-
openssl \
22-
openssl-dev \
2321
opus \
2422
opus-dev \
2523
py3-opencv \
@@ -28,9 +26,6 @@ RUN apk add --no-cache \
2826
python3-dev \
2927
yq
3028

31-
# Install python3 requirements
32-
# RUN pip3 install --no-cache-dir python-json2yaml==0.1.1
33-
3429
# Download source and untar
3530
WORKDIR /usr/bin
3631
ADD "https://github.com/Minims/SomfyProtect2MQTT/archive/refs/heads/dev.tar.gz" dev.tar.gz

SomfyProtect2MQTT-dev/build.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile
33
build_from:
4-
aarch64: ghcr.io/hassio-addons/base:17.1.0
4+
aarch64: ghcr.io/hassio-addons/base:17.1.1
55
amd64: ghcr.io/hassio-addons/base:16.3.6
6-
armhf: ghcr.io/hassio-addons/base:17.1.0
7-
armv7: ghcr.io/hassio-addons/base:17.1.0
6+
armhf: ghcr.io/hassio-addons/base:17.1.1
7+
armv7: ghcr.io/hassio-addons/base:17.1.1
88
i386: ghcr.io/hassio-addons/base:16.3.6
99
labels:
1010
org.opencontainers.image.title: "Home Assistant Add-on: Minims add-on"
1111
org.opencontainers.image.description: "Minims add-on to use as a blueprint for new add-ons."
1212
org.opencontainers.image.source: "https://github.com/Minims/homeassistant-addons"
1313
org.opencontainers.image.licenses: "Apache License 2.0"
1414
args:
15-
VERSION: "2025.2.0a"
15+
VERSION: "2025.2.0"

SomfyProtect2MQTT/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 2025.2.0
4+
5+
fix: restore 2025.1.0 version with fix for x86_64
6+
feature: Add smoke binary sensor
7+
38
## 2025.1.5
49

510
roolback: use somfyProtect2MQTT 2024.9.0

SomfyProtect2MQTT/Dockerfile

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,39 @@
11
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile
22
ARG BUILD_FROM
3-
FROM $BUILD_FROM
3+
FROM ${BUILD_FROM}
44
ENV LANG C.UTF-8
55

66
# SomfyProtect2MQTT version
7-
ARG VERSION=2024.9.0
7+
ARG VERSION=2025.2.0
88

9-
# Install required packages
10-
RUN apk add --no-cache py3-pip py3-opencv ffmpeg
11-
RUN pip3 install --no-cache-dir python-json2yaml==0.1.1
9+
# Copy root filesystem
10+
COPY rootfs /
11+
12+
# Setup base
13+
RUN apk update && apk add --no-cache \
14+
build-base \
15+
ffmpeg \
16+
ffmpeg-dev \
17+
libjxl \
18+
libjxl-tools \
19+
libsrtp \
20+
libsrtp-dev \
21+
libvpx \
22+
libvpx-dev \
23+
linux-headers \
24+
opus \
25+
opus-dev \
26+
py3-opencv \
27+
py3-pip \
28+
python3 \
29+
python3-dev \
30+
yq
1231

1332
# Download source and untar
1433
WORKDIR /usr/bin
1534
ADD "https://github.com/Minims/SomfyProtect2MQTT/archive/refs/tags/${VERSION}.tar.gz" ${VERSION}.tar.gz
16-
RUN tar -xvf ${VERSION}.tar.gz
17-
RUN mv /usr/bin/SomfyProtect2MQTT-${VERSION} /usr/bin/SomfyProtect2MQTT
35+
RUN tar -xvf ${VERSION}.tar.gz && mv /usr/bin/SomfyProtect2MQTT-${VERSION} /usr/bin/SomfyProtect2MQTT
1836

1937
# Install python3 requirements
2038
WORKDIR /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt
2139
RUN pip3 install --no-cache-dir -r requirements/addon.txt
22-
23-
# Copy root filesystem
24-
ADD rootfs /

SomfyProtect2MQTT/build.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
22
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile
33
build_from:
4-
aarch64: ghcr.io/hassio-addons/base:15.0.5
5-
amd64: ghcr.io/hassio-addons/base:15.0.5
6-
armhf: ghcr.io/hassio-addons/base:15.0.5
7-
armv7: ghcr.io/hassio-addons/base:15.0.5
8-
i386: ghcr.io/hassio-addons/base:15.0.5
4+
aarch64: ghcr.io/hassio-addons/base:17.1.1
5+
amd64: ghcr.io/hassio-addons/base:16.3.6
6+
armhf: ghcr.io/hassio-addons/base:17.1.1
7+
armv7: ghcr.io/hassio-addons/base:17.1.1
8+
i386: ghcr.io/hassio-addons/base:16.3.6
99
labels:
1010
org.opencontainers.image.title: "Home Assistant Add-on: Minims add-on"
1111
org.opencontainers.image.description: "Minims add-on to use as a blueprint for new add-ons."
1212
org.opencontainers.image.source: "https://github.com/Minims/homeassistant-addons"
1313
org.opencontainers.image.licenses: "Apache License 2.0"
1414
args:
15-
VERSION: "2024.9.0"
15+
VERSION: "2025.2.0"

SomfyProtect2MQTT/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
33
name: SomfyProtect2MQTT
4-
version: 2025.1.5
4+
version: 2025.2.0
55
slug: somfy-protect-2-mqtt
66
description: Publish Somfy Home Alarm as MQTT messages
77
url: https://github.com/Minims/homeassistant-addons/tree/main/SomfyProtect2MQTT
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/command/with-contenv bashio
2+
# shellcheck shell=bash
3+
# ==============================================================================
4+
# Home Assistant SomfyProtect2MQTT Add-on for Home Assistant
5+
# ==============================================================================
6+
declare exit_code
7+
readonly exit_code_container=$(</run/s6-linux-init-container-results/exitcode)
8+
readonly exit_code_service="${1}"
9+
readonly exit_code_signal="${2}"
10+
readonly service="somfyProtect2Mqtt"
11+
12+
bashio::log.info \
13+
"Service ${service} exited with code ${exit_code_service}" \
14+
"(by signal ${exit_code_signal})"
15+
16+
# Received a signal
17+
if [[ "${exit_code_service}" -eq 256 ]]; then
18+
19+
# The signal might be a result of another service crashing. Only
20+
# overwrite the container exit code if it is not already set.
21+
if [[ "${exit_code_container}" -eq 0 ]]; then
22+
echo $((128 + $exit_code_signal)) > /run/s6-linux-init-container-results/exitcode
23+
fi
24+
25+
# If the signal is SIGTERM, we should halt the container and take down
26+
# the whole process tree.
27+
[[ "${exit_code_signal}" -eq 15 ]] && exec /run/s6/basedir/bin/halt
28+
29+
# The service exited with a non-zero exit code, which means it crashed.
30+
elif [[ "${exit_code_service}" -ne 0 ]]; then
31+
32+
# The service might be a result of another service crashing. Only
33+
# overwrite the container exit code if it is not already set.
34+
if [[ "${exit_code_container}" -eq 0 ]]; then
35+
echo "${exit_code_service}" > /run/s6-linux-init-container-results/exitcode
36+
fi
37+
38+
# We should halt the container and take down the whole process tree.
39+
exec /run/s6/basedir/bin/halt
40+
41+
# The service exited with a zero exit code, which means it exited, let
42+
# S6 supervision restart it.
43+
else
44+
bashio::log.info "Service ${service} restarting..."
45+
fi

SomfyProtect2MQTT/rootfs/etc/services.d/SomfyProtect2MQTT/run renamed to SomfyProtect2MQTT/rootfs/etc/s6-overlay/s6-rc.d/SomfyProtect2MQTT/run

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
#!/usr/bin/with-contenv bashio
1+
#!/command/with-contenv bashio
2+
# shellcheck shell=bash
23
# ==============================================================================
3-
# Start the example service
4-
# s6-overlay docs: https://github.com/just-containers/s6-overlay
4+
# Home Assistant Community Add-on: SomfyProtect2MQTT
5+
# Runs SomfyProtect2MQTT
56
# ==============================================================================
67

7-
# Add your code here
8-
9-
#!/usr/bin/env bashio
10-
118
bashio::log.info "Generating config.yaml from options.json"
129
echo '# Generated by homeassistant, do not edit!' > /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt/config/config.yaml.tmp
1310
echo '# Edit configuration only at the Add-on configuration tab!' >> /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt/config/config.yaml.tmp
14-
json2yaml /data/options.json >> /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt/config/config.yaml.tmp
11+
yq -P -oy /data/options.json >> /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt/config/config.yaml.tmp
1512
sed 's/ -/ -/' /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt/config/config.yaml.tmp > /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt/config/config.yaml
1613
bashio::log.info "Configuration :"
1714
bashio::log.info "$(cat /usr/bin/SomfyProtect2MQTT/somfyProtect2Mqtt/config/config.yaml)"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
longrun

SomfyProtect2MQTT/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/SomfyProtect2MQTT

Whitespace-only changes.

SomfyProtect2MQTT/rootfs/etc/services.d/SomfyProtect2MQTT/finish

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)