From a4a01d774e7586ae6edf67b48b3ec11c809a1883 Mon Sep 17 00:00:00 2001 From: mak-gitdev Date: Wed, 13 Dec 2023 05:13:40 +0100 Subject: [PATCH] Version 0.1.28-1 - Fix issue mak-gitdev/ha_enoceanmqtt#106 - Fix issue on string comparison for MQTT device name in entity. --- addon-dev/CHANGELOG.md | 8 ++++++++ addon-dev/Dockerfile | 2 ++ addon-dev/config.yaml | 2 +- addon-dev/run.sh | 25 +++++++++++++++++++------ 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/addon-dev/CHANGELOG.md b/addon-dev/CHANGELOG.md index a609983..66cc0e0 100644 --- a/addon-dev/CHANGELOG.md +++ b/addon-dev/CHANGELOG.md @@ -1,3 +1,11 @@ +## 0.1.28-1 + +**Fix installation issue reported in mak-gitdev/ha_enoceanmqtt#106** +**Fix version comparison related to MQTT device name in entity (mak-gitdev/ha_enoceanmqtt#77)** + +It is not required to install this version if none of the fixes above is of interest for you. +**If you want to upgrade to this version, I can all but recommend to make a backup before.** + ## 0.1.28 **Important**: Add a new cover entity (cover2) for D2-05-00. This should fix inverted position issue (thanks to @didi31). diff --git a/addon-dev/Dockerfile b/addon-dev/Dockerfile index 1e0df30..c4a938d 100644 --- a/addon-dev/Dockerfile +++ b/addon-dev/Dockerfile @@ -8,6 +8,8 @@ WORKDIR /app # Install enoceanmqtt and requirements RUN apk add --no-cache python3 py3-pip git && \ + python3 -m venv /app/venv && \ + . /app/venv/bin/activate && \ python3 -m pip install --upgrade pip && \ pip3 install pyyaml && \ pip3 install tinydb && \ diff --git a/addon-dev/config.yaml b/addon-dev/config.yaml index e5d9985..1835706 100644 --- a/addon-dev/config.yaml +++ b/addon-dev/config.yaml @@ -1,7 +1,7 @@ name: "EnOcean MQTT (dev)" description: "EnOcean to MQTT bridge for Home Assistant" url: "https://github.com/mak-gitdev/HA_enoceanmqtt-addon" -version: "0.1.28" +version: "0.1.28-1" slug: "ha_enoceanmqtt_dev" stage: "experimental" init: false diff --git a/addon-dev/run.sh b/addon-dev/run.sh index f1796ba..53c11be 100644 --- a/addon-dev/run.sh +++ b/addon-dev/run.sh @@ -64,14 +64,26 @@ fi # Device name in entity name HA_VERSION="$(bashio::core.version)" +Year=$(echo ${HA_VERSION//[!0-9.]/} | cut -d '.' -f 1) +Month=$(echo ${HA_VERSION//[!0-9.]/} | cut -d '.' -f 2) -if [ "${HA_VERSION}" \> "2023.8" ] || [ "${HA_VERSION}" \= "2023.8" ]; then - if [ "${HA_VERSION}" \> "2024.2" ] || [ "${HA_VERSION}" \= "2024.2" ]; then - bashio::log.green "Overwrite use_dev_name_in_entity to FALSE" - USE_DEV_NAME_IN_ENTITY="False" +if [ ${Year} -ge 2023 ]; then + if [ ${Year} -eq 2023 ]; then + if [ ${Month} -lt 8 ]; then + bashio::log.green "Overwrite use_dev_name_in_entity to TRUE" + USE_DEV_NAME_IN_ENTITY="True" + else + USE_DEV_NAME_IN_ENTITY="$(bashio::config 'use_dev_name_in_entity')" + bashio::log.green "use_dev_name_in_entity is USER-DEFINED (${USE_DEV_NAME_IN_ENTITY})" + fi else - USE_DEV_NAME_IN_ENTITY="$(bashio::config 'use_dev_name_in_entity')" - bashio::log.green "use_dev_name_in_entity is USER-DEFINED (${USE_DEV_NAME_IN_ENTITY})" + if [ ${Year} -eq 2024 ] && [ ${Month} -lt 2 ]; then + USE_DEV_NAME_IN_ENTITY="$(bashio::config 'use_dev_name_in_entity')" + bashio::log.green "use_dev_name_in_entity is USER-DEFINED (${USE_DEV_NAME_IN_ENTITY})" + else + bashio::log.green "Overwrite use_dev_name_in_entity to FALSE" + USE_DEV_NAME_IN_ENTITY="False" + fi fi else bashio::log.green "Overwrite use_dev_name_in_entity to TRUE" @@ -119,4 +131,5 @@ if ! bashio::config.is_empty 'eep_file'; then fi bashio::log.green "Starting EnOceanMQTT..." +. /app/venv/bin/activate enoceanmqtt $DEBUG_FLAG --logfile $LOG_FILE $CONFIG_FILE