Allow all options

This commit is contained in:
Alexandre
2023-01-24 16:39:19 +01:00
parent 59bc5e5150
commit db4bb9ccb6
3 changed files with 19 additions and 21 deletions

View File

@@ -19,8 +19,7 @@ _Thanks to everyone having starred my repo! To star it click on the image below,
## About ## About
Enedisgateway2mqtt use Enedis Gateway API to send data in your MQTT Broker. MyElectricalData allows an automated access to your Enedis data. See its github for all informations : https://github.com/m4dm4rtig4n/myelectricaldata
See its github for all informations : https://github.com/m4dm4rtig4n/myelectricaldata
## Configuration ## Configuration
@@ -31,15 +30,15 @@ Options can be configured through two ways :
- Addon options - Addon options
```yaml ```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. 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 TZ: Europe/Paris # Sets a specific timezone
``` ```
- Config.yaml - 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 ## Installation

View File

@@ -6,13 +6,13 @@
], ],
"codenotary": "alexandrep.github@gmail.com", "codenotary": "alexandrep.github@gmail.com",
"description": "Use Enedis Gateway API to send data in your MQTT Broker (dev channel)", "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": [ "map": [
"config:rw" "config:rw"
], ],
"name": "MyElectricalData Dev", "name": "MyElectricalData Dev",
"options": { "options": {
"CONFIG_LOCATION": "/config/enedisgateway2mqtt_dev/config.yaml", "CONFIG_LOCATION": "/config/myelectricaldata_dev/config.yaml",
"TZ": "Europe/Paris", "TZ": "Europe/Paris",
"mqtt_autodiscover": true, "mqtt_autodiscover": true,
"verbose": true "verbose": true
@@ -35,4 +35,4 @@
"slug": "enedisgateway2mqtt_dev", "slug": "enedisgateway2mqtt_dev",
"url": "https://github.com/alexbelgium/hassio-addons", "url": "https://github.com/alexbelgium/hassio-addons",
"version": "0.8.13" "version": "0.8.13"
} }

View File

@@ -19,9 +19,14 @@ if [ -f /data/config.yaml ] && [ ! -L /data/config.yaml ]; then
mv /data/config.yaml "$CONFIGSOURCE".bak mv /data/config.yaml "$CONFIGSOURCE".bak
fi 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 migration was performed, save file in config folder
if [ -f /data/enedisgateway.db.migrate ]; then if [ -f /data/enedisgateway.db.migrate ]; then
@@ -31,7 +36,6 @@ fi
# If migration was performed, save file in config folder # If migration was performed, save file in config folder
if [ -f /data/cache.db ] && [ ! -f "$DATABASESOURCE" ]; then 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}")" mv /data/cache.db "$(dirname "${CONFIGSOURCE}")"
fi fi
@@ -40,6 +44,10 @@ if [ -f "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db ]; then
mv "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db /data mv "$(dirname "${CONFIGSOURCE}")"/enedisgateway.db /data
fi fi
############
# DATABASE #
############
# Check if database is here or create symlink # Check if database is here or create symlink
if [ -f "$DATABASESOURCE" ]; then if [ -f "$DATABASESOURCE" ]; then
# Create symlink if not existing yet # Create symlink if not existing yet
@@ -90,13 +98,4 @@ echo " "
bashio::log.info "Starting the app" bashio::log.info "Starting the app"
echo " " 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?" python -u /app/main.py || bashio::log.fatal "The app has crashed. Are you sure you entered the correct config options?"