Skip to content

Commit

Permalink
Update run.sh
Browse files Browse the repository at this point in the history
Remove need to specify "driversdir"
  • Loading branch information
BIBOLV committed Oct 6, 2024
1 parent b5859d8 commit a7acfdc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions wmbusmeters-ha-addon-edge/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ RESET_CONF=$(bashio::config 'reset_config')

if [ ! -f ${CONFIG_PATH} ]
then
echo '{"data_path": "/config/wmbusmeters", "enable_mqtt_discovery": "false", "conf": {"loglevel": "normal", "driversdir": "/data/drivers", "device": "auto:t1", "donotprobe": "/dev/ttyAMA0", "logtelegrams": "false", "format": "json", "logfile": "/dev/stdout", "shell": "/wmbusmeters/mosquitto_pub.sh \"wmbusmeters/$METER_NAME\" \"$METER_JSON\""}, "meters": [], "mqtt": {}}' | jq . > ${CONFIG_PATH}
echo '{"data_path": "/config/wmbusmeters", "enable_mqtt_discovery": "false", "conf": {"loglevel": "normal", "device": "auto:t1", "donotprobe": "/dev/ttyAMA0", "logtelegrams": "false", "format": "json", "logfile": "/dev/stdout", "shell": "/wmbusmeters/mosquitto_pub.sh \"wmbusmeters/$METER_NAME\" \"$METER_JSON\""}, "meters": [], "mqtt": {}}' | jq . > ${CONFIG_PATH}
fi

if [ "${RESET_CONF}" = "yes" ]
then
bashio::log.info "RESET CONFIG selected - reseting add-on configuration to default ..."
echo '{"data_path": "/config/wmbusmeters", "enable_mqtt_discovery": "false", "conf": {"loglevel": "normal", "driversdir": "/data/drivers", "device": "auto:t1", "donotprobe": "/dev/ttyAMA0", "logtelegrams": "false", "format": "json", "logfile": "/dev/stdout", "shell": "/wmbusmeters/mosquitto_pub.sh \"wmbusmeters/$METER_NAME\" \"$METER_JSON\""}, "meters": [], "mqtt": {}}' | jq . > ${CONFIG_PATH}
echo '{"data_path": "/config/wmbusmeters", "enable_mqtt_discovery": "false", "conf": {"loglevel": "normal", "device": "auto:t1", "donotprobe": "/dev/ttyAMA0", "logtelegrams": "false", "format": "json", "logfile": "/dev/stdout", "shell": "/wmbusmeters/mosquitto_pub.sh \"wmbusmeters/$METER_NAME\" \"$METER_JSON\""}, "meters": [], "mqtt": {}}' | jq . > ${CONFIG_PATH}
bashio::addon.option "reset_config" "no"
bashio::addon.restart
fi
Expand All @@ -32,10 +32,15 @@ fi
if ! bashio::fs.directory_exists "${CONFIG_DATA_PATH}/etc/wmbusmeters.d"; then
mkdir -p "${CONFIG_DATA_PATH}/etc/wmbusmeters.d"
fi
if ! bashio::fs.directory_exists "${CONFIG_DATA_PATH}/etc/wmbusmeters.drivers.d"; then
mkdir -p "${CONFIG_DATA_PATH}/etc/wmbusmeters.drivers.d"
fi
if [ ! -d /data/drivers ]
then
mkdir -p /data/drivers
fi
rm -rf ${CONFIG_DATA_PATH}/etc/wmbusmeters.drivers.d/*
cp /data/drivers/* ${CONFIG_DATA_PATH}/etc/wmbusmeters.drivers.d/

echo -e "$CONFIG_CONF" | jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' > $CONFIG_DATA_PATH/etc/wmbusmeters.conf

Expand Down

0 comments on commit a7acfdc

Please sign in to comment.