diff --git a/smartnut/DOCS.md b/smartnut/DOCS.md index 2260358..f4f852a 100644 --- a/smartnut/DOCS.md +++ b/smartnut/DOCS.md @@ -68,7 +68,7 @@ For now: * just start SmartNUT (for USB) and/or use enable enable_simulated_device, * check the Journal tab for the startup sequence, * listen on MQTT topic 'homeassistant/nut/#' using MQTT integration (FIXME), -* and have fun :D +* and have fun :smile: ## Configuration diff --git a/smartnut/rootfs/etc/cont-init.d/smartnut.sh b/smartnut/rootfs/etc/cont-init.d/smartnut.sh index 47032f7..aacf517 100755 --- a/smartnut/rootfs/etc/cont-init.d/smartnut.sh +++ b/smartnut/rootfs/etc/cont-init.d/smartnut.sh @@ -25,6 +25,7 @@ if bashio::config.true 'autoconf_usb_devices' ;then bashio::log.info "Autodetecting and configuring USB devices" nut-scanner -U > "${UPS_CONF}" + bashio::log.info "=> OK" fi if bashio::config.true 'manual_edit_devices' ;then @@ -33,7 +34,6 @@ if bashio::config.true 'manual_edit_devices' ;then # FIXME: process manual edits fi - if bashio::config.true 'enable_simulated_device' ;then # https://networkupstools.org/docs/developer-guide.chunked/dev-tools.html @@ -45,6 +45,7 @@ if bashio::config.true 'enable_simulated_device' ;then echo -e "\tport = smartnut-dummy.seq" } >> "${UPS_CONF}" + bashio::log.info "=> OK" fi # MQTT config @@ -73,12 +74,14 @@ if [ -z "$MQTT_HOST"]; then MQTT_PASSWORD=$(bashio::services mqtt "password") fi -# FIXME: sanity check (-n MQTT_HOST MQTT_USER MQTT_PASSWORD) and error catching # FIXME # - ca: str? # - key: str? # - cert: str? +# FIXME: MQTT sanity check (-n MQTT_HOST MQTT_USER MQTT_PASSWORD) and error catching +bashio::log.info "=> OK" + # FIXME: get config... { echo "MQTT_HOST=$MQTT_HOST" @@ -92,13 +95,13 @@ bashio::log.info "${UPS_CONF}" cat "${UPS_CONF}" bashio::log.info "/etc/nut/libnutdrv_mqtt.conf" cat /etc/nut/libnutdrv_mqtt.conf +# FIXME: -s sanity check +bashio::log.info "=> OK" bashio::log.info "---------------------" bashio::log.info "Starting the SmartNUT Driver(s)..." upsdrvctl -u root start -#/usr/lib/nut/usbhid-ups -u root -a nutdev1 -sleep 5 -bashio::log.info "Driver(s) started..." +bashio::log.info "=> OK" bashio::log.info "---------------------" bashio::log.info "Starting the SmartNUT2MQTT Adapter..." diff --git a/smartnut/rootfs/usr/bin/dstate-nut2mqtt b/smartnut/rootfs/usr/bin/dstate-nut2mqtt index 927fda5..daf1462 100755 --- a/smartnut/rootfs/usr/bin/dstate-nut2mqtt +++ b/smartnut/rootfs/usr/bin/dstate-nut2mqtt @@ -3,7 +3,7 @@ # File: dstate-nut2mqtt # Version: 0.4 # Description -# Script that queries and parses data from NUT drivers Unix sockets (using netcat) +# Script that queries and parses data from NUT drivers Unix sockets (using netcat), # then transform these into MQTT payload to publish (using mosquitto_pub) # This technic: # * just requires standard public NUT versions (source or binary packages) @@ -148,9 +148,8 @@ process_dump() } # Main -echo "Starting `basename $0`" -echo "------------------------" -echo "CWD: `pwd`" +debug "Starting `basename $0`" +debug "------------------------" # Setup context # Cleanup