From 0d5002adc118e1809135f922f78ffe1b230bca35 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 24 Jan 2023 14:45:41 +0100 Subject: [PATCH 1/7] Rename image and folder --- enedisgateway2mqtt/config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enedisgateway2mqtt/config.json b/enedisgateway2mqtt/config.json index fb1d982ac..7f4836cd7 100644 --- a/enedisgateway2mqtt/config.json +++ b/enedisgateway2mqtt/config.json @@ -6,13 +6,13 @@ ], "codenotary": "alexandrep.github@gmail.com", "description": "Use Enedis Gateway API to send data in your MQTT Broker (latest channel)", - "image": "ghcr.io/alexbelgium/enedisgateway2mqtt-{arch}", + "image": "ghcr.io/alexbelgium/myelectricaldata-{arch}", "map": [ "config:rw" ], "name": "MyElectricalData", "options": { - "CONFIG_LOCATION": "/config/enedisgateway2mqtt/config.yaml", + "CONFIG_LOCATION": "/config/myelectricaldata/config.yaml", "TZ": "Europe/Paris", "mqtt_autodiscover": true, "verbose": true From bade699babc90a61e57e16da21ea97a0e551d955 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 24 Jan 2023 14:48:36 +0100 Subject: [PATCH 2/7] Migrate folder --- enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh b/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh index efcabdc44..75f01a29a 100755 --- a/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh +++ b/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh @@ -19,6 +19,15 @@ if [ -f /data/config.yaml ] && [ ! -L /data/config.yaml ]; then mv /data/config.yaml "$CONFIGSOURCE".bak fi +###################################### +# MIGRATE FOLDER TO MYELECTRICALDATA # +###################################### + +if [ -f /config/addons_config/enedisgateway2mqtt/config.yaml ]; then + mv /config/addons_config/enedisgateway2mqtt/* "$(dirname "${CONFIGSOURCE}")"/ + rm -r /config/addons_config/enedisgateway2mqtt +fi + ############ # DATABASE # ############ From c7bee28a7f9791f5b7bf483e98cc1babaa5704a4 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 24 Jan 2023 14:54:26 +0100 Subject: [PATCH 3/7] Clean file --- .../rootfs/etc/cont-init.d/99-run.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh b/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh index 75f01a29a..731ae8dee 100755 --- a/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh +++ b/enedisgateway2mqtt/rootfs/etc/cont-init.d/99-run.sh @@ -19,19 +19,15 @@ if [ -f /data/config.yaml ] && [ ! -L /data/config.yaml ]; then mv /data/config.yaml "$CONFIGSOURCE".bak fi -###################################### -# MIGRATE FOLDER TO MYELECTRICALDATA # -###################################### +######################################################### +# MIGRATION FROM ENEDISGATEWAY2MQTT TO MYELECTRICALDATA # +######################################################### if [ -f /config/addons_config/enedisgateway2mqtt/config.yaml ]; then mv /config/addons_config/enedisgateway2mqtt/* "$(dirname "${CONFIGSOURCE}")"/ rm -r /config/addons_config/enedisgateway2mqtt fi -############ -# DATABASE # -############ - # If migration was performed, save file in config folder if [ -f /data/enedisgateway.db.migrate ]; then bashio::log.warning "Migration performed, enedisgateway.db.migrate copied in $(dirname "${CONFIGSOURCE}")" @@ -40,7 +36,6 @@ fi # If migration was performed, save file in config folder if [ -f /data/cache.db ] && [ ! -f "$DATABASESOURCE" ]; then - if [ -f "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db ]; then mv "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db.bak2; fi mv /data/cache.db "$(dirname "${CONFIGSOURCE}")" fi @@ -49,6 +44,10 @@ if [ -f "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db ]; then mv "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db /data fi +############ +# DATABASE # +############ + # Check if database is here or create symlink if [ -f "$DATABASESOURCE" ]; then # Create symlink if not existing yet From 694d3b7c49d468d216ee692eaac4ff6b7cc1fa51 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 24 Jan 2023 16:03:51 +0100 Subject: [PATCH 4/7] Update README.md --- enedisgateway2mqtt/README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/enedisgateway2mqtt/README.md b/enedisgateway2mqtt/README.md index f0095033d..a877807fe 100644 --- a/enedisgateway2mqtt/README.md +++ b/enedisgateway2mqtt/README.md @@ -19,8 +19,7 @@ _Thanks to everyone having starred my repo! To star it click on the image below, ## About -Enedisgateway2mqtt use Enedis Gateway API to send data in your MQTT Broker. -See its github for all informations : https://github.com/m4dm4rtig4n/myelectricaldata +MyElectricalData allows an automated access to your Enedis data. See its github for all informations : https://github.com/m4dm4rtig4n/myelectricaldata ## Configuration @@ -31,15 +30,15 @@ Options can be configured through two ways : - Addon options ```yaml -CONFIG_LOCATION: /config/enedisgateway2mqtt/enedisgateway2mqtt.conf # Sets the location of the config.yaml (see below) +CONFIG_LOCATION: /config/myelectricaldata/config.yaml # Sets the location of the config.yaml (see below) mqtt_autodiscover: true # Shows in the log the detail of the mqtt local server (if available). It can then be added to the config.yaml file. TZ: Europe/Paris # Sets a specific timezone ``` - Config.yaml - Everything is configured using the config.yaml file found in /config/enedisgateway2mqtt/enedisgateway2mqtt.conf. + Everything is configured using the config.yaml file found in /config/myelectricaldata/config.yaml. -The complete list of options can be seen here : https://github.com/m4dm4rtig4n/enedisgateway2mqtt#environment-variable +The complete list of options can be seen here : https://github.com/m4dm4rtig4n/myelectricaldata/wiki/03.-Configuration ## Installation From 59bc5e51508e93bf4513550a65b88f982c88fa76 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 24 Jan 2023 16:29:40 +0100 Subject: [PATCH 5/7] Update config.json --- enedisgateway2mqtt/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enedisgateway2mqtt/config.json b/enedisgateway2mqtt/config.json index 7f4836cd7..d066043e0 100644 --- a/enedisgateway2mqtt/config.json +++ b/enedisgateway2mqtt/config.json @@ -34,5 +34,5 @@ ], "slug": "enedisgateway2mqtt", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "0.8.13-2" + "version": "0.8.13-3" } From db4bb9ccb6cd457c1b2e0792e421e79c6909eb34 Mon Sep 17 00:00:00 2001 From: Alexandre Date: Tue, 24 Jan 2023 16:39:19 +0100 Subject: [PATCH 6/7] Allow all options --- enedisgateway2mqtt_dev/README.md | 9 +++---- enedisgateway2mqtt_dev/config.json | 6 ++--- .../rootfs/etc/cont-init.d/99-run.sh | 25 +++++++++---------- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/enedisgateway2mqtt_dev/README.md b/enedisgateway2mqtt_dev/README.md index f0095033d..a877807fe 100644 --- a/enedisgateway2mqtt_dev/README.md +++ b/enedisgateway2mqtt_dev/README.md @@ -19,8 +19,7 @@ _Thanks to everyone having starred my repo! To star it click on the image below, ## About -Enedisgateway2mqtt use Enedis Gateway API to send data in your MQTT Broker. -See its github for all informations : https://github.com/m4dm4rtig4n/myelectricaldata +MyElectricalData allows an automated access to your Enedis data. See its github for all informations : https://github.com/m4dm4rtig4n/myelectricaldata ## Configuration @@ -31,15 +30,15 @@ Options can be configured through two ways : - Addon options ```yaml -CONFIG_LOCATION: /config/enedisgateway2mqtt/enedisgateway2mqtt.conf # Sets the location of the config.yaml (see below) +CONFIG_LOCATION: /config/myelectricaldata/config.yaml # Sets the location of the config.yaml (see below) mqtt_autodiscover: true # Shows in the log the detail of the mqtt local server (if available). It can then be added to the config.yaml file. TZ: Europe/Paris # Sets a specific timezone ``` - Config.yaml - Everything is configured using the config.yaml file found in /config/enedisgateway2mqtt/enedisgateway2mqtt.conf. + Everything is configured using the config.yaml file found in /config/myelectricaldata/config.yaml. -The complete list of options can be seen here : https://github.com/m4dm4rtig4n/enedisgateway2mqtt#environment-variable +The complete list of options can be seen here : https://github.com/m4dm4rtig4n/myelectricaldata/wiki/03.-Configuration ## Installation diff --git a/enedisgateway2mqtt_dev/config.json b/enedisgateway2mqtt_dev/config.json index 94c102408..46f83773b 100644 --- a/enedisgateway2mqtt_dev/config.json +++ b/enedisgateway2mqtt_dev/config.json @@ -6,13 +6,13 @@ ], "codenotary": "alexandrep.github@gmail.com", "description": "Use Enedis Gateway API to send data in your MQTT Broker (dev channel)", - "image": "ghcr.io/alexbelgium/enedisgateway2mqtt_dev-{arch}", + "image": "ghcr.io/alexbelgium/myelectricaldata_dev-{arch}", "map": [ "config:rw" ], "name": "MyElectricalData Dev", "options": { - "CONFIG_LOCATION": "/config/enedisgateway2mqtt_dev/config.yaml", + "CONFIG_LOCATION": "/config/myelectricaldata_dev/config.yaml", "TZ": "Europe/Paris", "mqtt_autodiscover": true, "verbose": true @@ -35,4 +35,4 @@ "slug": "enedisgateway2mqtt_dev", "url": "https://github.com/alexbelgium/hassio-addons", "version": "0.8.13" -} +} \ No newline at end of file diff --git a/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/99-run.sh b/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/99-run.sh index 68eaef97c..7c7b01645 100755 --- a/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/99-run.sh +++ b/enedisgateway2mqtt_dev/rootfs/etc/cont-init.d/99-run.sh @@ -19,9 +19,14 @@ if [ -f /data/config.yaml ] && [ ! -L /data/config.yaml ]; then mv /data/config.yaml "$CONFIGSOURCE".bak fi -############ -# DATABASE # -############ +######################################################### +# MIGRATION FROM ENEDISGATEWAY2MQTT TO MYELECTRICALDATA # +######################################################### + +if [ -f /config/addons_config/enedisgateway2mqtt_dev/config.yaml ]; then + mv /config/addons_config/enedisgateway2mqtt_dev/* "$(dirname "${CONFIGSOURCE}")"/ + rm -r /config/addons_config/enedisgateway2mqtt_dev +fi # If migration was performed, save file in config folder if [ -f /data/enedisgateway.db.migrate ]; then @@ -31,7 +36,6 @@ fi # If migration was performed, save file in config folder if [ -f /data/cache.db ] && [ ! -f "$DATABASESOURCE" ]; then - if [ -f "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db ]; then mv "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db.bak2; fi mv /data/cache.db "$(dirname "${CONFIGSOURCE}")" fi @@ -40,6 +44,10 @@ if [ -f "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db ]; then mv "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db /data fi +############ +# DATABASE # +############ + # Check if database is here or create symlink if [ -f "$DATABASESOURCE" ]; then # Create symlink if not existing yet @@ -90,13 +98,4 @@ echo " " bashio::log.info "Starting the app" echo " " -# Test mode -TZ=$(bashio::config "TZ") -if [ "$TZ" = "test" ]; then - echo "secret mode found, launching script in /config/test.sh" - cd /config || exit - chmod 777 test.sh - ./test.sh -fi - python -u /app/main.py || bashio::log.fatal "The app has crashed. Are you sure you entered the correct config options?" From 973ee7f2f969a1bce179192a85fd78f18ca649ce Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 24 Jan 2023 19:24:30 +0100 Subject: [PATCH 7/7] Update config.json --- enedisgateway2mqtt_dev/config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enedisgateway2mqtt_dev/config.json b/enedisgateway2mqtt_dev/config.json index 46f83773b..3671c29a9 100644 --- a/enedisgateway2mqtt_dev/config.json +++ b/enedisgateway2mqtt_dev/config.json @@ -34,5 +34,5 @@ ], "slug": "enedisgateway2mqtt_dev", "url": "https://github.com/alexbelgium/hassio-addons", - "version": "0.8.13" -} \ No newline at end of file + "version": "0.8.13-2" +}