Skip to content

Commit

Permalink
cfg changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BIBOLV committed Nov 3, 2024
1 parent d39d260 commit fdf23c4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
13 changes: 13 additions & 0 deletions wmbusmeters-ha-addon-edge/rootfs/etc/services.d/wmbusmeters/finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bashio
# ==============================================================================
# Take down the S6 supervision tree when service fails
# s6-overlay docs: https://github.com/just-containers/s6-overlay
# ==============================================================================

if [[ "$1" -ne 0 ]] && [[ "$1" -ne 256 ]]; then
bashio::log.warning "wmbusmeters exited with status $1. Restarting..."
sleep 2
exit 111
fi

exit 0
9 changes: 4 additions & 5 deletions wmbusmeters-ha-addon-edge/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ 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/ || true
if [ -n "$(ls -A /data/drivers 2>/dev/null)" ]; then
cp /data/drivers/* "${CONFIG_DATA_PATH}/etc/wmbusmeters.drivers.d/"
fi

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

Expand Down Expand Up @@ -111,8 +113,5 @@ chmod a+x /wmbusmeters/mosquitto_pub.sh
# Running MQTT discovery
/mqtt_discovery.sh ${pub_args[@]} -c $CONFIG_PATH -w $CONFIG_DATA_PATH || true

#bashio::log.info "Starting web configuration service."
#python3 /flask/app.py &

bashio::log.info "Running wmbusmeters ..."
/wmbusmeters/wmbusmeters --usestdoutforlogging --useconfig=$CONFIG_DATA_PATH
/wmbusmeters/wmbusmeters --useconfig=$CONFIG_DATA_PATH

0 comments on commit fdf23c4

Please sign in to comment.