mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-21 08:11:50 +02:00
rename
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
ARG BUILD_UPSTREAM="0.6.0"
|
ARG BUILD_UPSTREAM="0.7.1-dev"
|
||||||
FROM m4dm4rtig4n/enedisgateway2mqtt:$BUILD_UPSTREAM
|
FROM m4dm4rtig4n/enedisgateway2mqtt:$BUILD_UPSTREAM
|
||||||
|
|
||||||
# Base system
|
# Base system
|
||||||
@@ -7,6 +7,7 @@ ARG BASHIO_VERSION=0.13.1
|
|||||||
# Copy root filesystem
|
# Copy root filesystem
|
||||||
COPY rootfs /
|
COPY rootfs /
|
||||||
VOLUME [ "/config" ]
|
VOLUME [ "/config" ]
|
||||||
|
ENV TZ=Europe/Paris
|
||||||
|
|
||||||
RUN \
|
RUN \
|
||||||
################
|
################
|
||||||
|
|||||||
@@ -2,53 +2,16 @@
|
|||||||
"arch": ["aarch64", "amd64", "armv7", "armhf"],
|
"arch": ["aarch64", "amd64", "armv7", "armhf"],
|
||||||
"description": "use Enedis Gateway API to send data in your MQTT Broker",
|
"description": "use Enedis Gateway API to send data in your MQTT Broker",
|
||||||
"map": ["config:rw"],
|
"map": ["config:rw"],
|
||||||
"name": "Enedisgateway2mqtt",
|
"name": "Enedisgateway2mqtt_test",
|
||||||
"options": {
|
"options": {
|
||||||
"ACCESS_TOKEN": "xxx",
|
"CONFIG_LOCATION": "/config/enedisgateway2mqtt/config.yaml"
|
||||||
"PDL": "xxx",
|
|
||||||
"MQTT_HOST": "xxx.xxx.xxx.xxx",
|
|
||||||
"DEBUG": true
|
|
||||||
},
|
},
|
||||||
"schema": {
|
"schema": {
|
||||||
"ACCESS_TOKEN": "str?",
|
"CONFIG_LOCATION": "str",
|
||||||
"PDL": "str?",
|
"TZ": "str?"
|
||||||
"MQTT_HOST": "str?",
|
|
||||||
"custom_var": "str?",
|
|
||||||
"test": "bool?",
|
|
||||||
"MQTT_PORT": "int?",
|
|
||||||
"MQTT_PREFIX": "str?",
|
|
||||||
"MQTT_CLIENT_ID": "str?",
|
|
||||||
"MQTT_USERNAME": "str?",
|
|
||||||
"MQTT_PASSWORD": "str?",
|
|
||||||
"RETAIN": "bool?",
|
|
||||||
"QOS": "int?",
|
|
||||||
"GET_CONSUMPTION": "bool?",
|
|
||||||
"GET_CONSUMPTION_DETAIL": "bool?",
|
|
||||||
"GET_PRODUCTION": "bool?",
|
|
||||||
"GET_PRODUCTION_DETAIL": "bool?",
|
|
||||||
"HA_AUTODISCOVERY": "bool?",
|
|
||||||
"HA_AUTODISCOVERY_PREFIX": "str?",
|
|
||||||
"OFFPEAK_HOURS": "str?",
|
|
||||||
"CONSUMPTION_PRICE_BASE": "str?",
|
|
||||||
"CONSUMPTION_PRICE_HC": "str?",
|
|
||||||
"CONSUMPTION_PRICE_HP": "str?",
|
|
||||||
"CYCLE": "int?",
|
|
||||||
"ADDRESSES": "bool?",
|
|
||||||
"REFRESH_CONTRACT": "bool?",
|
|
||||||
"REFRESH_ADDRESSES": "bool?",
|
|
||||||
"WIPE_CACHE": "bool?",
|
|
||||||
"DEBUG": "bool?",
|
|
||||||
"CARD_MYENEDIS": "bool?",
|
|
||||||
"CURRENT_PLAN": "str?",
|
|
||||||
"INFLUXDB_ENABLE": "bool?",
|
|
||||||
"INFLUXDB_HOST": "str?",
|
|
||||||
"INFLUXDB_PORT": "int?",
|
|
||||||
"INFLUXDB_TOKEN": "str?",
|
|
||||||
"INFLUXDB_ORG": "str?",
|
|
||||||
"INFLUXDB_BUCKET": "str?"
|
|
||||||
},
|
},
|
||||||
"slug": "enedisgateway2mqtt",
|
"slug": "enedisgateway2mqtt",
|
||||||
"upstream": "0.6.0",
|
"upstream": "0.7.1",
|
||||||
"url": "https://github.com/alexbelgium/hassio-addons",
|
"url": "https://github.com/alexbelgium/hassio-addons",
|
||||||
"version": "0.6.0-12"
|
"version": "0.7.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,144 +1,37 @@
|
|||||||
#!/usr/bin/env bashio
|
#!/usr/bin/env bashio
|
||||||
|
|
||||||
############################
|
# Where is the config
|
||||||
# Check if config is there #
|
CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION")
|
||||||
############################
|
|
||||||
|
|
||||||
if bashio::config.true "test"; then
|
|
||||||
# Where is the config
|
|
||||||
CONFIGSOURCE="/config/enedisgateway2mqtt/config.yaml"
|
|
||||||
|
|
||||||
# Check if config file is there, or create one from template
|
|
||||||
if [ -f $CONFIGSOURCE ]; then
|
|
||||||
echo "Using config file found in $CONFIGSOURCE"
|
|
||||||
else
|
|
||||||
echo "No config file, creating one from template"
|
|
||||||
# Create folder
|
|
||||||
mkdir -p "$(dirname "${CONFIGSOURCE}")"
|
|
||||||
# Downloading template
|
|
||||||
TEMPLATESOURCE="https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/enedisgateway2mqtt/rootfs/templates/config.yaml"
|
|
||||||
curl -L -f -s $TEMPLATESOURCE --output $CONFIGSOURCE
|
|
||||||
# Placing template in config
|
|
||||||
#cp config.yaml "$(dirname "${CONFIGSOURCE}")"
|
|
||||||
# Need to restart
|
|
||||||
bashio::log.fatal "Config file not found, creating a new one. Please customize the file in $CONFIGSOURCE before restarting."
|
|
||||||
bashio::exit.nok
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if yaml is valid
|
|
||||||
yamllint -d relaxed --no-warnings $CONFIGSOURCE &> ERROR
|
|
||||||
if [ $? = 0 ]; then
|
|
||||||
echo "Config file is a valid yaml"
|
|
||||||
else
|
|
||||||
bashio::log.fatal "Config file has an invalid yaml format. Please check the file in $CONFIGSOURCE. Errors list :"
|
|
||||||
cat ERROR
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create symlink
|
|
||||||
[ -f /data/config.yaml ] && rm /data/config.yaml
|
|
||||||
ln -s $CONFIGSOURCE /data
|
|
||||||
echo "Symlink created"
|
|
||||||
|
|
||||||
# Export all yaml entries as env variables
|
|
||||||
# Helper function
|
|
||||||
function parse_yaml {
|
|
||||||
local prefix=$2 || local prefix=""
|
|
||||||
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
|
|
||||||
sed -ne "s|^\($s\):|\1|" \
|
|
||||||
-e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \
|
|
||||||
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
|
|
||||||
awk -F$fs '{
|
|
||||||
indent = length($1)/2;
|
|
||||||
vname[indent] = $2;
|
|
||||||
for (i in vname) {if (i > indent) {delete vname[i]}}
|
|
||||||
if (length($3) > 0) {
|
|
||||||
vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
|
|
||||||
printf("%s%s%s=\"%s\"\n", "'$prefix'",vn, $2, $3);
|
|
||||||
}
|
|
||||||
}'
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get variables and export
|
|
||||||
bashio::log.info "Starting the app with the variables in /config/enedisgateway2mqtt"
|
|
||||||
for word in $(parse_yaml $CONFIGSOURCE conf); do
|
|
||||||
# Data validation
|
|
||||||
if [[ $word =~ ^.+[=].+$ ]]; then
|
|
||||||
export $word # Export the variable
|
|
||||||
bashio::log.blue "$word"
|
|
||||||
else
|
|
||||||
bashio::log.fatal "$word does not follow the structure KEY=text, it will be ignored and removed from the config"
|
|
||||||
sed -i "/$word/ d" ${CONFIGSOURCE}
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
|
# Check if config file is there, or create one from template
|
||||||
|
if [ -f $CONFIGSOURCE ]; then
|
||||||
|
echo "Using config file found in $CONFIGSOURCE"
|
||||||
|
else
|
||||||
|
echo "No config file, creating one from template"
|
||||||
|
# Create folder
|
||||||
|
mkdir -p "$(dirname "${CONFIGSOURCE}")"
|
||||||
|
# Placing template in config
|
||||||
|
cp /data/config.yaml "$(dirname "${CONFIGSOURCE}")" &>/dev/null \
|
||||||
|
|| cp /templates/config.yaml "$(dirname "${CONFIGSOURCE}")"
|
||||||
|
# Need to restart
|
||||||
|
bashio::log.fatal "Config file not found, creating a new one. Please customize the file in $CONFIGSOURCE before restarting."
|
||||||
|
bashio::exit.nok
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#################
|
# Check if yaml is valid
|
||||||
# Create config #
|
yamllint -d relaxed --no-warnings $CONFIGSOURCE &> ERROR || EXIT_CODE=$?
|
||||||
#################
|
if [ $EXIT_CODE = 0 ]; then
|
||||||
|
echo "Config file is a valid yaml"
|
||||||
|
else
|
||||||
|
cat ERROR
|
||||||
|
bashio::log.fatal "Config file has an invalid yaml format. Please check the file in $CONFIGSOURCE. Errors list above."
|
||||||
|
bashio::exit.nok
|
||||||
|
fi
|
||||||
|
|
||||||
# Create the config file
|
# Create symlink
|
||||||
CONFIGSOURCE="/config/enedisgateway2mqtt/enedisgateway2mqtt.conf" #file
|
[ -f /data/config.yaml ] && rm /data/config.yaml
|
||||||
mkdir -p "$(dirname "${CONFIGSOURCE}")" #create dir
|
ln -s $CONFIGSOURCE /data
|
||||||
touch ${CONFIGSOURCE} #create file
|
echo "Symlink created"
|
||||||
|
|
||||||
##########################
|
|
||||||
# Read all addon options #
|
|
||||||
##########################
|
|
||||||
bashio::log.info "All variables defined in the addon will be exported to the config file located in /config/enedisgateway2mqtt"
|
|
||||||
|
|
||||||
# Get the default keys from the original file
|
|
||||||
JSONSOURCE="/data/options.json"
|
|
||||||
mapfile -t arr < <(jq -r 'keys[]' ${JSONSOURCE})
|
|
||||||
# For all keys in options.json
|
|
||||||
for KEYS in ${arr[@]}; do
|
|
||||||
# if the custom_var field is used
|
|
||||||
if [ "${KEYS}" = "custom_var" ]; then
|
|
||||||
VALUES=$(jq .$KEYS ${JSONSOURCE}) # Get list of custom elements
|
|
||||||
VALUES=${VALUES:1:-1} # Remove first and last ""
|
|
||||||
for SUBKEYS in ${VALUES//,/ }; do
|
|
||||||
[[ ! $SUBKEYS =~ ^.+[=].+$ ]] && bashio::log.warning "Your custom_var field $SUBKEYS does not follow the structure KEY=\"text\",KEY2=\"text2\" it will be ignored" && continue || true
|
|
||||||
# Remove the key if already existing
|
|
||||||
sed -i "/$(echo "${SUBKEYS%%=*}")/ d" ${CONFIGSOURCE}
|
|
||||||
# Remove apostrophes
|
|
||||||
SUBKEYS=${SUBKEYS//[\"\']/}
|
|
||||||
# Write it in the config file
|
|
||||||
echo ${SUBKEYS} >>${CONFIGSOURCE}
|
|
||||||
# Say it loud
|
|
||||||
# echo "... ${SUBKEYS}"
|
|
||||||
done
|
|
||||||
# If it is a normal field
|
|
||||||
else
|
|
||||||
# Remove if already existing
|
|
||||||
sed -i "/$KEYS/ d" ${CONFIGSOURCE}
|
|
||||||
# Store key
|
|
||||||
KEYS=$(echo "${KEYS}=$(jq .$KEYS ${JSONSOURCE})")
|
|
||||||
# Remove apostrophes
|
|
||||||
KEYS=${KEYS//[\"\']/}
|
|
||||||
# Write it in the config file
|
|
||||||
echo $KEYS >>${CONFIGSOURCE}
|
|
||||||
# Say it loud
|
|
||||||
# echo "... ${KEYS}=$(jq .$KEYS ${JSONSOURCE})"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
###########################
|
|
||||||
# Read all config options #
|
|
||||||
###########################
|
|
||||||
|
|
||||||
bashio::log.info "Starting the app with the variables in /config/enedisgateway2mqtt"
|
|
||||||
|
|
||||||
# For all keys in config file
|
|
||||||
for word in $(cat $CONFIGSOURCE); do
|
|
||||||
# Data validation
|
|
||||||
if [[ $word =~ ^.+[=].+$ ]]; then
|
|
||||||
export $word # Export the variable
|
|
||||||
bashio::log.blue "$word"
|
|
||||||
else
|
|
||||||
bashio::log.fatal "$word does not follow the structure KEY=text, it will be ignored and removed from the config"
|
|
||||||
sed -i "/$word/ d" ${CONFIGSOURCE}
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# Launch App #
|
# Launch App #
|
||||||
|
|||||||
@@ -1,11 +1,63 @@
|
|||||||
---
|
##########
|
||||||
doe: "a deer, a female deer"
|
# GLOBAL #
|
||||||
ray: "a drop of golden sun"
|
##########
|
||||||
pi: 3.14159
|
debug: false
|
||||||
xmas: true
|
|
||||||
french-hens: 3
|
####################
|
||||||
calling-birds:
|
## MQTT ##
|
||||||
- huey
|
####################
|
||||||
- dewey
|
mqtt:
|
||||||
- louie
|
host: MOSQUITO_SERVER # MANDATORY
|
||||||
- fred
|
port: 1883
|
||||||
|
username: ""
|
||||||
|
password: ""
|
||||||
|
prefix: enedis_gateway
|
||||||
|
client_id: enedis_gateway
|
||||||
|
retain: true
|
||||||
|
qos: 0
|
||||||
|
|
||||||
|
####################
|
||||||
|
## Home assistant ##
|
||||||
|
####################
|
||||||
|
home_assistant:
|
||||||
|
discovery: false
|
||||||
|
discovery_prefix: homeassistant
|
||||||
|
card_myenedis: false
|
||||||
|
|
||||||
|
###############
|
||||||
|
## Influx DB ##
|
||||||
|
###############
|
||||||
|
#influxdb:
|
||||||
|
# host: MY_INFLUXDB_SERVER
|
||||||
|
# port: 8086
|
||||||
|
# token: MY_TOKEN
|
||||||
|
# org: MY_ORG
|
||||||
|
# bucket: MY_BUCKET
|
||||||
|
|
||||||
|
####################
|
||||||
|
## ENEDIS GATEWAY ##
|
||||||
|
####################
|
||||||
|
enedis_gateway:
|
||||||
|
PDL_1: # MANDATORY
|
||||||
|
token: PDL_1_TOKEN # MANDATORY
|
||||||
|
plan: BASE # BASE or HP/HC
|
||||||
|
consumption: true
|
||||||
|
consumption_detail: true
|
||||||
|
consumption_price_hc: 0
|
||||||
|
consumption_price_hp: 0
|
||||||
|
consumption_price_base: 0
|
||||||
|
production: false
|
||||||
|
production_detail: false
|
||||||
|
# offpeak_hours: "" # USE ONLY IF YOU WANT OVERLOAD DEFAULT VALUE, Format : 22h36-00h10;01h00-06h00
|
||||||
|
addresses: true
|
||||||
|
# PDL_2:
|
||||||
|
# token: PDL_2_TOKEN
|
||||||
|
# plan: HP/HC
|
||||||
|
# consumption: true
|
||||||
|
# consumption_detail: true
|
||||||
|
# consumption_price_hc: 0.1781
|
||||||
|
# consumption_price_hp: 0.1337
|
||||||
|
# consumption_price_base: 0.1781
|
||||||
|
# production: false
|
||||||
|
# production_detail: false
|
||||||
|
# addresses: true
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
- Allows setting options through 3 ways, see addon readme
|
|
||||||
- Data validation
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
ARG BUILD_UPSTREAM="0.7.1-dev"
|
|
||||||
FROM m4dm4rtig4n/enedisgateway2mqtt:$BUILD_UPSTREAM
|
|
||||||
|
|
||||||
# Base system
|
|
||||||
ARG BASHIO_VERSION=0.13.1
|
|
||||||
|
|
||||||
# Copy root filesystem
|
|
||||||
COPY rootfs /
|
|
||||||
VOLUME [ "/config" ]
|
|
||||||
ENV TZ=Europe/Paris
|
|
||||||
|
|
||||||
RUN \
|
|
||||||
################
|
|
||||||
# Install apps #
|
|
||||||
################
|
|
||||||
apt-get clean \
|
|
||||||
&& apt-get update \
|
|
||||||
&& apt-get install -y \
|
|
||||||
jq \
|
|
||||||
curl \
|
|
||||||
yamllint \
|
|
||||||
&& apt-get clean \
|
|
||||||
\
|
|
||||||
##################
|
|
||||||
# Install bashio #
|
|
||||||
##################
|
|
||||||
&& mkdir -p /tmp/bashio \
|
|
||||||
&& curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" \
|
|
||||||
| tar -xzf - --strip 1 -C /tmp/bashio \
|
|
||||||
&& mv /tmp/bashio/lib /usr/lib/bashio \
|
|
||||||
&& ln -s /usr/lib/bashio/bashio /usr/bin/bashio \
|
|
||||||
&& rm -rf /tmp/bashio || true
|
|
||||||
|
|
||||||
RUN chmod 777 /entrypoint.sh
|
|
||||||
ENTRYPOINT [ "/usr/bin/env" ]
|
|
||||||
CMD ["/entrypoint.sh"]
|
|
||||||
VOLUME [ "/data" ]
|
|
||||||
|
|
||||||
### LABELS
|
|
||||||
ARG BUILD_ARCH
|
|
||||||
ARG BUILD_DATE
|
|
||||||
ARG BUILD_DESCRIPTION
|
|
||||||
ARG BUILD_NAME
|
|
||||||
ARG BUILD_REF
|
|
||||||
ARG BUILD_REPOSITORY
|
|
||||||
ARG BUILD_VERSION
|
|
||||||
LABEL \
|
|
||||||
io.hass.name="${BUILD_NAME}" \
|
|
||||||
io.hass.description="${BUILD_DESCRIPTION}" \
|
|
||||||
io.hass.arch="${BUILD_ARCH}" \
|
|
||||||
io.hass.type="addon" \
|
|
||||||
io.hass.version=${BUILD_VERSION} \
|
|
||||||
maintainer="alexbelgium (https://github.com/alexbelgium)" \
|
|
||||||
org.opencontainers.image.title="${BUILD_NAME}" \
|
|
||||||
org.opencontainers.image.description="${BUILD_DESCRIPTION}" \
|
|
||||||
org.opencontainers.image.vendor="Home Assistant Add-ons" \
|
|
||||||
org.opencontainers.image.authors="alexbelgium (https://github.com/alexbelgium)" \
|
|
||||||
org.opencontainers.image.licenses="MIT" \
|
|
||||||
org.opencontainers.image.url="https://github.com/alexbelgium" \
|
|
||||||
org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \
|
|
||||||
org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \
|
|
||||||
org.opencontainers.image.created=${BUILD_DATE} \
|
|
||||||
org.opencontainers.image.revision=${BUILD_REF} \
|
|
||||||
org.opencontainers.image.version=${BUILD_VERSION}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
# Home assistant add-on: Enedisgateway2mqtt
|
|
||||||
|
|
||||||
[![Donate][donation-badge]](https://www.buymeacoffee.com/alexbelgium)
|
|
||||||
|
|
||||||
[donation-badge]: https://img.shields.io/badge/Buy%20me%20a%20coffee-%23d32f2f?logo=buy-me-a-coffee&style=flat&logoColor=white
|
|
||||||
|
|
||||||
![Supports
|
|
||||||
Architecture][aarch64-shield] ![Supports amd64 Architecture][amd64-shield] ![Supports armhf Architecture][armhf-shield] ![Supports armv7 Architecture][armv7-shield]
|
|
||||||
|
|
||||||
_Thanks to everyone having starred my repo! To star it click on the image below, then it will be on top right. Thanks!_
|
|
||||||
|
|
||||||
[](https://github.com/alexbelgium/hassio-addons/stargazers)
|
|
||||||
|
|
||||||
## About
|
|
||||||
|
|
||||||
Enedisgateway2mqtt use Enedis Gateway API to send data in your MQTT Broker.
|
|
||||||
See its github for all informations : https://github.com/m4dm4rtig4n/enedisgateway2mqtt/blob/master/README.md
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
There are 3 ways to configure this addon :
|
|
||||||
- Using the addon options
|
|
||||||
- Using the custom_var field, where variables not already defined in the addon options can be described using the format : var1=text1,var2=text2
|
|
||||||
- Manually editing the file /config/enedisgateway2mqtt/enedisgateway2mqtt.conf and adding options with the format var1=text1
|
|
||||||
|
|
||||||
All variables defined the in the addon options and custom_var fields are automatically copied in the /config/enedisgateway2mqtt/enedisgateway2mqtt.conf file.
|
|
||||||
|
|
||||||
The complete list of options can be seen here : https://github.com/m4dm4rtig4n/enedisgateway2mqtt#environment-variable
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
The installation of this add-on is pretty straightforward and not different in
|
|
||||||
comparison to installing any other Hass.io add-on.
|
|
||||||
|
|
||||||
1. [Add my Hass.io add-ons repository][repository] to your Hass.io instance.
|
|
||||||
1. Install this add-on.
|
|
||||||
1. Click the `Save` button to store your configuration.
|
|
||||||
1. Start the add-on.
|
|
||||||
1. Check the logs of the add-on to see if everything went well.
|
|
||||||
1. Carefully configure the add-on to your preferences, see the official documentation for for that.
|
|
||||||
|
|
||||||
[smb-shield]: https://img.shields.io/badge/SMB--green?style=plastic.svg
|
|
||||||
[repository]: https://github.com/alexbelgium/hassio-addons
|
|
||||||
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg
|
|
||||||
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg
|
|
||||||
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg
|
|
||||||
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
#include <tunables/global>
|
|
||||||
|
|
||||||
profile inadyn_addon flags=(attach_disconnected,mediate_deleted) {
|
|
||||||
#include <abstractions/base>
|
|
||||||
|
|
||||||
capability,
|
|
||||||
file,
|
|
||||||
mount,
|
|
||||||
umount,
|
|
||||||
remount,
|
|
||||||
capability setgid,
|
|
||||||
capability setuid,
|
|
||||||
|
|
||||||
|
|
||||||
# S6-Overlay
|
|
||||||
/bin/** ix,
|
|
||||||
/usr/bin/** ix,
|
|
||||||
/usr/lib/bashio/** ix,
|
|
||||||
/etc/s6/** rix,
|
|
||||||
/run/s6/** rix,
|
|
||||||
/etc/services.d/** rwix,
|
|
||||||
/etc/cont-init.d/** rwix,
|
|
||||||
/etc/cont-finish.d/** rwix,
|
|
||||||
/init rix,
|
|
||||||
/var/run/** mrwkl,
|
|
||||||
/var/run/ mrwkl,
|
|
||||||
/dev/i2c-1 mrwkl,
|
|
||||||
|
|
||||||
# Data access
|
|
||||||
/data/** rw,
|
|
||||||
|
|
||||||
# suppress ptrace denials when using 'docker ps' or using 'ps' inside a container
|
|
||||||
ptrace (trace,read) peer=docker-default,
|
|
||||||
|
|
||||||
# docker daemon confinement requires explict allow rule for signal
|
|
||||||
signal (receive) set=(kill,term) peer=/usr/bin/docker,
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"arch": ["aarch64", "amd64", "armv7", "armhf"],
|
|
||||||
"description": "use Enedis Gateway API to send data in your MQTT Broker",
|
|
||||||
"map": ["config:rw"],
|
|
||||||
"name": "Enedisgateway2mqtt_test",
|
|
||||||
"options": {
|
|
||||||
"CONFIG_LOCATION": "/config/enedisgateway2mqtt/config.yaml"
|
|
||||||
},
|
|
||||||
"schema": {
|
|
||||||
"CONFIG_LOCATION": "str",
|
|
||||||
"TZ": "str?"
|
|
||||||
},
|
|
||||||
"slug": "enedisgateway2mqtt_test",
|
|
||||||
"upstream": "0.7.1",
|
|
||||||
"url": "https://github.com/alexbelgium/hassio-addons",
|
|
||||||
"version": "0.7.1"
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.3 KiB |
@@ -1,11 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo "Starting scripts :"
|
|
||||||
for SCRIPTS in scripts/*; do
|
|
||||||
[ -e "$SCRIPTS" ] || continue
|
|
||||||
echo "$SCRIPTS: executing"
|
|
||||||
chown $(id -u):$(id -g) $SCRIPTS
|
|
||||||
chmod a+x $SCRIPTS
|
|
||||||
sed -i 's|/usr/bin/with-contenv bashio|/usr/bin/env bashio|g' $SCRIPTS || true
|
|
||||||
./$SCRIPTS || echo "$SCRIPTS: exiting $?"
|
|
||||||
done
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
#!/usr/bin/with-contenv bashio
|
|
||||||
# ==============================================================================
|
|
||||||
# Home Assistant Community Add-on: Base Images
|
|
||||||
# Displays a simple add-on banner on startup
|
|
||||||
# ==============================================================================
|
|
||||||
if bashio::supervisor.ping; then
|
|
||||||
bashio::log.blue \
|
|
||||||
'-----------------------------------------------------------'
|
|
||||||
bashio::log.blue " Add-on: $(bashio::addon.name)"
|
|
||||||
bashio::log.blue " $(bashio::addon.description)"
|
|
||||||
bashio::log.blue \
|
|
||||||
'-----------------------------------------------------------'
|
|
||||||
|
|
||||||
bashio::log.blue " Add-on version: $(bashio::addon.version)"
|
|
||||||
if bashio::var.true "$(bashio::addon.update_available)"; then
|
|
||||||
bashio::log.magenta ' There is an update available for this add-on!'
|
|
||||||
bashio::log.magenta \
|
|
||||||
" Latest add-on version: $(bashio::addon.version_latest)"
|
|
||||||
bashio::log.magenta ' Please consider upgrading as soon as possible.'
|
|
||||||
else
|
|
||||||
bashio::log.green ' You are running the latest version of this add-on.'
|
|
||||||
fi
|
|
||||||
|
|
||||||
bashio::log.blue " System: $(bashio::info.operating_system)" \
|
|
||||||
" ($(bashio::info.arch) / $(bashio::info.machine))"
|
|
||||||
bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)"
|
|
||||||
bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)"
|
|
||||||
|
|
||||||
bashio::log.blue \
|
|
||||||
'-----------------------------------------------------------'
|
|
||||||
bashio::log.blue \
|
|
||||||
' Please, share the above information when looking for help'
|
|
||||||
bashio::log.blue \
|
|
||||||
' or support in, e.g., GitHub, forums or the Discord chat.'
|
|
||||||
bashio::log.green \
|
|
||||||
' https://github.com/alexbelgium/hassio-addons'
|
|
||||||
bashio::log.blue \
|
|
||||||
'-----------------------------------------------------------'
|
|
||||||
fi
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
#!/usr/bin/env bashio
|
|
||||||
|
|
||||||
# Where is the config
|
|
||||||
CONFIGSOURCE=$(bashio::config "CONFIG_LOCATION")
|
|
||||||
|
|
||||||
# Check if config file is there, or create one from template
|
|
||||||
if [ -f $CONFIGSOURCE ]; then
|
|
||||||
echo "Using config file found in $CONFIGSOURCE"
|
|
||||||
else
|
|
||||||
echo "No config file, creating one from template"
|
|
||||||
# Create folder
|
|
||||||
mkdir -p "$(dirname "${CONFIGSOURCE}")"
|
|
||||||
# Placing template in config
|
|
||||||
cp /data/config.yaml "$(dirname "${CONFIGSOURCE}")" &>/dev/null \
|
|
||||||
|| cp /templates/config.yaml "$(dirname "${CONFIGSOURCE}")"
|
|
||||||
# Need to restart
|
|
||||||
bashio::log.fatal "Config file not found, creating a new one. Please customize the file in $CONFIGSOURCE before restarting."
|
|
||||||
bashio::exit.nok
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if yaml is valid
|
|
||||||
yamllint -d relaxed --no-warnings $CONFIGSOURCE &> ERROR || EXIT_CODE=$?
|
|
||||||
if [ $EXIT_CODE = 0 ]; then
|
|
||||||
echo "Config file is a valid yaml"
|
|
||||||
else
|
|
||||||
cat ERROR
|
|
||||||
bashio::log.fatal "Config file has an invalid yaml format. Please check the file in $CONFIGSOURCE. Errors list above."
|
|
||||||
bashio::exit.nok
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create symlink
|
|
||||||
[ -f /data/config.yaml ] && rm /data/config.yaml
|
|
||||||
ln -s $CONFIGSOURCE /data
|
|
||||||
echo "Symlink created"
|
|
||||||
|
|
||||||
##############
|
|
||||||
# Launch App #
|
|
||||||
##############
|
|
||||||
echo " "
|
|
||||||
bashio::log.info "Starting the app"
|
|
||||||
echo " "
|
|
||||||
|
|
||||||
python -u /app/main.py || bashio::log.fatal "The app has crashed. Are you sure you entered the correct config options?"
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
##########
|
|
||||||
# GLOBAL #
|
|
||||||
##########
|
|
||||||
debug: false
|
|
||||||
|
|
||||||
####################
|
|
||||||
## MQTT ##
|
|
||||||
####################
|
|
||||||
mqtt:
|
|
||||||
host: MOSQUITO_SERVER # MANDATORY
|
|
||||||
port: 1883
|
|
||||||
username: ""
|
|
||||||
password: ""
|
|
||||||
prefix: enedis_gateway
|
|
||||||
client_id: enedis_gateway
|
|
||||||
retain: true
|
|
||||||
qos: 0
|
|
||||||
|
|
||||||
####################
|
|
||||||
## Home assistant ##
|
|
||||||
####################
|
|
||||||
home_assistant:
|
|
||||||
discovery: false
|
|
||||||
discovery_prefix: homeassistant
|
|
||||||
card_myenedis: false
|
|
||||||
|
|
||||||
###############
|
|
||||||
## Influx DB ##
|
|
||||||
###############
|
|
||||||
#influxdb:
|
|
||||||
# host: MY_INFLUXDB_SERVER
|
|
||||||
# port: 8086
|
|
||||||
# token: MY_TOKEN
|
|
||||||
# org: MY_ORG
|
|
||||||
# bucket: MY_BUCKET
|
|
||||||
|
|
||||||
####################
|
|
||||||
## ENEDIS GATEWAY ##
|
|
||||||
####################
|
|
||||||
enedis_gateway:
|
|
||||||
PDL_1: # MANDATORY
|
|
||||||
token: PDL_1_TOKEN # MANDATORY
|
|
||||||
plan: BASE # BASE or HP/HC
|
|
||||||
consumption: true
|
|
||||||
consumption_detail: true
|
|
||||||
consumption_price_hc: 0
|
|
||||||
consumption_price_hp: 0
|
|
||||||
consumption_price_base: 0
|
|
||||||
production: false
|
|
||||||
production_detail: false
|
|
||||||
# offpeak_hours: "" # USE ONLY IF YOU WANT OVERLOAD DEFAULT VALUE, Format : 22h36-00h10;01h00-06h00
|
|
||||||
addresses: true
|
|
||||||
# PDL_2:
|
|
||||||
# token: PDL_2_TOKEN
|
|
||||||
# plan: HP/HC
|
|
||||||
# consumption: true
|
|
||||||
# consumption_detail: true
|
|
||||||
# consumption_price_hc: 0.1781
|
|
||||||
# consumption_price_hp: 0.1337
|
|
||||||
# consumption_price_base: 0.1781
|
|
||||||
# production: false
|
|
||||||
# production_detail: false
|
|
||||||
# addresses: true
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# If dockerfile failed install manually
|
|
||||||
[ ! -f "/usr/bin/bashio" ]; then
|
|
||||||
echo "Bashio does not exist, executing script"
|
|
||||||
|
|
||||||
################
|
|
||||||
# Install apps #
|
|
||||||
################
|
|
||||||
apt-get clean &&
|
|
||||||
apt-get update &&
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
jq \
|
|
||||||
curl \
|
|
||||||
yamllint
|
|
||||||
|
|
||||||
###################
|
|
||||||
# Install bashio #
|
|
||||||
##################
|
|
||||||
BASHIO_VERSION=0.13.1
|
|
||||||
mkdir -p /tmp/bashio
|
|
||||||
curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" |
|
|
||||||
tar -xzf - --strip 1 -C /tmp/bashio
|
|
||||||
mv /tmp/bashio/lib /usr/lib/bashio
|
|
||||||
ln -s /usr/lib/bashio/bashio /usr/bin/bashio
|
|
||||||
rm -rf /tmp/bashio
|
|
||||||
|
|
||||||
echo "Bashio installed"
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user