
* Update en.yaml Update options * Prettified Code! * Update en.yaml * Prettified Code! * Update en.yaml * Update Dockerfile curl dev version -> rc3 chmod changed to folders instead of files taillog auto logs to dev stdout.. it is just a timestamp now * Update build.yaml codenotary.. * Update taillog.sh SBFspot 3.9.6 logging changes no files anymore. so just timestamp. * Update genBluetoothConfig.sh converted to bashio * Update genEthernetConfig.sh converted to bashio * Create genSenBlue Created for Bluetooth inverter sensors * Create genSenEth created for Ethernet inverter sensors makes set config * Create mqttSensorConfig making sensors.. * Create purgeSen purge sensors... * Create nanorc nano defaults. * Update finish exit code changes * Update run sensors and bashio changes * Update config.yaml defaulted most options in bashio * Update en.yaml spaces... * Update en.yaml * Update en.yaml * Update en.yaml * Prettified Code! * Update config.yaml * Update DOCS.md updating for changes and making pretty * Update README.md * Prettified Code! * Add files via upload * Update README.md * Update DOCS.md * Update en.yaml * Prettified Code! * Update README.md * Prettified Code! * Update DOCS.md * Update en.yaml * Prettified Code! * Update README.md * Update en.yaml * Prettified Code! * Update DOCS.md * Update en.yaml * Prettified Code! * Update README.md * Update .mdlrc * Prettified Code! * Update DOCS.md * Update CHANGELOG.md 2022.9.1 * Update README.md * Update DOCS.md * Update README.md * Update README.md * Update DOCS.md * Delete UI options.PNG renaming * Delete mqqt Capture.PNG renaming * Add files via upload * Update README.md * Update README.md * Delete MQTTcapture.PNG * Add files via upload * Update README.md * Update DOCS.md * Update CHANGELOG.md * Update README.md * Update DOCS.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: habuild <habuild@users.noreply.github.com>
95 lines
3.7 KiB
Text
95 lines
3.7 KiB
Text
#!/usr/bin/with-contenv bashio
|
|
# ==============================================================================
|
|
# Start the SBFspot service
|
|
# s6-overlay docs: https://github.com/just-containers/s6-overlay
|
|
# ==============================================================================
|
|
|
|
CONFIG_PATH=/data/options.json
|
|
#CFG_PATH=/usr/bin/sbfspot/SBFspot.cfg
|
|
#CFG_UPLOAD_PATH=/usr/bin/sbfspot/SBFspotUpload.cfg
|
|
|
|
# --- GENERATE CONFIG --
|
|
message=$(echo "PWD is current directory $(pwd)")
|
|
bashio::log.debug "${message:=""}"
|
|
cd /
|
|
|
|
message=$(echo "PWD is current directory $(pwd)")
|
|
bashio::log.debug "${message:=""}"
|
|
|
|
# ---- Print Host sys info
|
|
message=$(echo "$(uname -smrv)")
|
|
bashio::log.info
|
|
bashio::log.info ${__BASHIO_COLORS_CYAN} "${message:="Hello World..."}"
|
|
bashio::log.info
|
|
|
|
# ---- Print Host BT Controller
|
|
message=$(echo "[Host Bluetooth MAC Address] $(bluetoothctl list)")
|
|
bashio::log.info
|
|
bashio::log.info ${__BASHIO_COLORS_BLUE} "${message:="Hello World..."}"
|
|
bashio::log.info
|
|
|
|
#set -x
|
|
|
|
var="$(jq --raw-output '.Sensors_HA' $CONFIG_PATH)"
|
|
if bashio::var.equals "${var}" "No"; then
|
|
bashio::log.yellow '| SKIPPING MQTT SENSOR CREATION |'
|
|
|
|
elif bashio::var.equals "${var}" "Create"; then
|
|
bashio::log.magenta '| INITIALISE MQTT SENSOR CREATION |'
|
|
/usr/bin/sbfspot/mqttSensorConfig
|
|
|
|
elif bashio::var.equals "$var" "Purge"; then
|
|
bashio::log.red '| PURGING SENSORS FROM MQTT |'
|
|
bashio::log.red '| CONFIRM REMOVAL IN |'
|
|
bashio::log.red '| HA MQTT INTEGRATION |'
|
|
bashio::log.red '| MQTT BROKER RETAINED MSGS |'
|
|
bashio::log.red '| STATISTICS |'
|
|
/usr/bin/sbfspot/purgeSen
|
|
else
|
|
bashio::log.cyan '| No One knows how you got here |'
|
|
bashio::log.cyan '| check your option selection |'
|
|
fi
|
|
|
|
value=$(bashio::config 'Connection_Type')
|
|
if bashio::var.equals "${value}" "Bluetooth"; then
|
|
/usr/bin/sbfspot/genBluetoothConfig.sh /usr/bin/sbfspot/SBFspot.cfg /usr/bin/sbfspot/SBFspotUpload.cfg
|
|
bashio::log.info
|
|
bashio::log.info
|
|
message=$(echo "|| Generating Bluetooth Configs ||")
|
|
bashio::log.info ${__BASHIO_COLORS_BLUE} "${message:=""}"
|
|
message=$(echo "|| /usr/bin/sbfspot/SBFspot.cfg ||")
|
|
bashio::log.info ${__BASHIO_COLORS_BLUE} "${message:=""}"
|
|
message=$(echo "|| /usr/bin/sbfspot/SBFspotUpload.cfg ||")
|
|
bashio::log.info ${__BASHIO_COLORS_BLUE} "${message:=""}"
|
|
bashio::log.info
|
|
elif bashio::var.equals "${value}" "Ethernet"; then
|
|
/usr/bin/sbfspot/genEthernetConfig.sh /usr/bin/sbfspot/SBFspot.cfg /usr/bin/sbfspot/SBFspotUpload.cfg
|
|
bashio::log.info
|
|
bashio::log.info
|
|
message=$(echo "|| Generating Ethernet Configs ||")
|
|
bashio::log.info ${__BASHIO_COLORS_MAGENTA} "${message:=""}"
|
|
message=$(echo "|| /usr/bin/sbfspot/SBFspot.cfg ||")
|
|
bashio::log.info ${__BASHIO_COLORS_MAGENTA} "${message:=""}"
|
|
message=$(echo "|| /usr/bin/sbfspot/SBFspotUpload.cfg ||")
|
|
bashio::log.info ${__BASHIO_COLORS_MAGENTA} "${message:=""}"
|
|
bashio::log.info
|
|
bashio::log.info
|
|
else
|
|
bashio::log.info ${__BASHIO_COLORS_RED} ================================
|
|
bashio::log.info ${__BASHIO_COLORS_RED} "Setup failed to create Configs"
|
|
bashio::log.info ${__BASHIO_COLORS_RED} ================================
|
|
fi
|
|
|
|
# ---- RUN ----
|
|
message=$(echo "[Starting SBFspotUpload]")
|
|
bashio::log.info ${__BASHIO_COLORS_MAGENTA} "${message:=""}"
|
|
|
|
# ---- Symbolic Links ----
|
|
ln -sf /usr/bin/sbfspot/SBFspot /SBFspot
|
|
ln -sf /usr/bin/sbfspot/SBFspot.cfg /SBFspot.cfg
|
|
ln -sf /usr/bin/sbfspot/SBFspotUpload.cfg /SBFspotUpload.cfg
|
|
|
|
# cron
|
|
message=$(echo "[Starting cron in foreground]")
|
|
bashio::log.info "${message:=""}"
|
|
exec /usr/sbin/crond -f
|