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
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

View File

@@ -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

View File

@@ -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?"