
* 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>
809 lines
45 KiB
Text
809 lines
45 KiB
Text
#!/usr/bin/with-contenv bashio
|
|
#
|
|
# Publish MQTT sensors for Config discovery.
|
|
|
|
set -e
|
|
CONFIG_PATH=/data/options.json
|
|
|
|
PLANTNAME="$(bashio::config 'Plantname')"
|
|
MQTT_Host="$(bashio::config 'MQTT_Host' 'core-mosquitto')"
|
|
MQTT_User="$(bashio::config 'MQTT_User')"
|
|
MQTT_Pass="$(bashio::config 'MQTT_Pass')"
|
|
MQTT_Topic="$(bashio::config 'MQTT_Topic')"
|
|
MQTT_Data="$(bashio::config 'MQTT_Data')"
|
|
# arg="$(jq --raw-output '.MQTT_Data' /data/options.json | tr ',' '\n')"
|
|
|
|
ts="$(bashio::config 'DateTimeFormat' '%H:%M:%S %d/%m/%Y')"
|
|
|
|
bashio::log.magenta "$PLANTNAME"
|
|
bashio::log.red "${MQTT_Host}"
|
|
bashio::log.green "${MQTT_User}"
|
|
# echo "${MQTT_Pass}"
|
|
bashio::log.blue "${MQTT_Topic}"
|
|
bashio::log.cyan "${MQTT_Data}"
|
|
|
|
# make set config
|
|
if bashio::fs.file_exists '/data/device'; then
|
|
bashio::log.info Using Existing Device info
|
|
else
|
|
value="$(bashio::config 'Connection_Type')"
|
|
if bashio::var.equals "${value}" "Bluetooth"; then
|
|
/usr/bin/sbfspot/genSenBlue
|
|
bashio::log.info
|
|
bashio::log.info
|
|
bashio::log.info "${__BASHIO_COLORS_BLUE}" "|| Generating HA Sensors ||"
|
|
|
|
# Use SetConfig.cfg to post initial mqtt msg for sensors
|
|
/usr/bin/sbfspot/SBFspot -v -finq -mqtt -cfg/usr/bin/sbfspot/SetConfig.cfg
|
|
|
|
# Subscribe to read SBFspot sensor post
|
|
mosquitto_sub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t "$(bashio::addon.name)/device" -C 1 > /data/device
|
|
|
|
elif bashio::var.equals "${value}" "Ethernet"; then
|
|
/usr/bin/sbfspot/genSenEth
|
|
bashio::log.info
|
|
bashio::log.info
|
|
message=$(echo "|| Generating HA Sensors ||")
|
|
bashio::log.info "${__BASHIO_COLORS_MAGENTA}" "${message:=""}"
|
|
|
|
# Use SetConfig.cfg to post initial mqtt msg for sensors
|
|
/usr/bin/sbfspot/SBFspot -v -finq -mqtt -cfg/usr/bin/sbfspot/SetConfig.cfg
|
|
|
|
# Subscribe to read SBFspot sensor post
|
|
mosquitto_sub -h "${MQTT_Host}" -u "${MQTT_User}" -P "${MQTT_Pass}" -t "$(bashio::addon.name)/device" -C 1 > /data/device
|
|
|
|
else
|
|
bashio::log.info "${__BASHIO_COLORS_RED}" ===================================
|
|
bashio::log.info "${__BASHIO_COLORS_RED}" "Setup failed to create HA Sensors"
|
|
bashio::log.info "${__BASHIO_COLORS_RED}" ===================================
|
|
fi
|
|
fi
|
|
|
|
DEVICE_PATH=/data/device
|
|
|
|
InvSerial="$(jq --raw-output '.InvSerial' $DEVICE_PATH)" # <<< ---- change to Dummy serial if needed to get from mqtt
|
|
InvName="$(jq --raw-output '.InvName' $DEVICE_PATH)" # <<< ---- prints bad formant SN: SerialNo or perhaps not
|
|
InvSwVer="$(jq --raw-output '.InvSwVer' $DEVICE_PATH)"
|
|
InvType="$(jq --raw-output '.InvType' $DEVICE_PATH)"
|
|
InvClass="$(jq --raw-output '.InvClass' $DEVICE_PATH)"
|
|
BTmac="$(jq --raw-output '.BTAddress' /data/options.json | tr -d ':' )" # <<< --- Compress BT MAC to use in Unique ID
|
|
|
|
|
|
bashio::log "$(cat "$DEVICE_PATH" | jq -C )"
|
|
|
|
#bashio::log.info "${__BASHIO_COLORS_RED}" "${InvSerial}"
|
|
#bashio::log.info "${__BASHIO_COLORS_RED}" "${InvName}"
|
|
#bashio::log.info "${__BASHIO_COLORS_RED}" "${InvSwVer}"
|
|
#bashio::log.info "${__BASHIO_COLORS_RED}" "${InvType}"
|
|
#bashio::log.info "${__BASHIO_COLORS_RED}" "${InvClass}"
|
|
#bashio::log.info "${__BASHIO_COLORS_RED}" "${BTmac}"
|
|
|
|
# Can this be used to send to options or cache?
|
|
#bashio::addon.option 'InvSerial' "${InvSerial}"
|
|
|
|
bashio::log.cyan "${InvSerial}"
|
|
|
|
|
|
|
|
debugMQTT='--quiet' # debug '-d' or '--quiet'
|
|
RoK='-r' # retain '-r' or '-d' depending on value above
|
|
|
|
# Array stuff #### https://stackoverflow.com/questions/3685970/check-if-a-bash-array-contains-a-value
|
|
#if [[ " ${array[*]} " =~ " ${value} " ]]; then
|
|
# # whatever you want to do when array contains value
|
|
#fi
|
|
#
|
|
#if [[ ! " ${array[*]} " =~ " ${value} " ]]; then
|
|
# # whatever you want to do when array doesn't contain value
|
|
#fi
|
|
#
|
|
## ALL MQTT_Data Option Values ARRAY creation ## https://riptutorial.com/bash/example/27007/split-string-into-an-array-in-bash
|
|
IFS=',' read -r -a array <<< "$MQTT_Data"
|
|
bashio::log.magenta "${array[@]}"
|
|
|
|
###### MAKE SENSORS #######
|
|
|
|
value='InvName'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Inverter Nom'
|
|
mdi_icon='mdi:card-bulleted'
|
|
# devClass= << add in \"device_class\": \"$devClass\",
|
|
# stClass= << add in \"state_class\": \"$stClass\",
|
|
# UoM= << add in \"unit_of_measurement\": \"$UoM\",
|
|
EnabDef='true'
|
|
ent_cat='diagnostic'
|
|
|
|
bashio::log.info Setting Up "${value}"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"enabled_by_default\": \"$EnabDef\", \"entity_category\": \"$ent_cat\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='Timestamp'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Timestamp'
|
|
mdi_icon='mdi:clock-digital'
|
|
devClass='timestamp' # 'timestamp' fiddly needs to be correctly formatted with TZ data <<# #>> null none empty not allowed. #\"device_class\": \"$devClass\",#
|
|
stClass=
|
|
UoM=
|
|
EnabDef='true'
|
|
ent_cat= ### diagnostic config sensor # sensor can't be sent so # \"entity_category\": \"$ent_cat\", # removed https://developers.home-assistant.io/docs/core/entity
|
|
|
|
bashio::log.info Setting Up "${value}"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"enabled_by_default\": \"$EnabDef\", \"device_class\": \"$devClass\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='InvTime'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Time Inverter'
|
|
mdi_icon='mdi:clock'
|
|
devClass='timestamp' ### class removed to allow custom timestamps for InvTime SunRise and SunSet
|
|
stClass=
|
|
UoM=
|
|
EnabDef='true'
|
|
ent_cat='diagnostic'
|
|
ts="$(bashio::config 'DateTimeFormat')"
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | as_timestamp | timestamp_custom( $ts ) | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"enabled_by_default\": \"$EnabDef\", \"entity_category\": \"$ent_cat\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='SunRise'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Sun Rise'
|
|
mdi_icon='mdi:weather-sunny'
|
|
devClass= ### no class for timestamp custom
|
|
stClass=
|
|
UoM=
|
|
EnabDef='true'
|
|
ent_cat=
|
|
ts="$(bashio::config 'DateTimeFormat')"
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | as_timestamp | timestamp_custom( $ts ) | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='SunSet'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
value='SunSet'
|
|
describe='SMA Sun Set'
|
|
mdi_icon='mdi:weather-hazy'
|
|
devClass= ### no class for timestamp custom
|
|
stClass=
|
|
UoM=
|
|
EnabDef='true'
|
|
ent_cat=
|
|
ts="$(bashio::config 'DateTimeFormat')"
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | as_timestamp | timestamp_custom( $ts ) | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='InvSerial'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
value='InvSerial'
|
|
describe='SMA Serial No'
|
|
mdi_icon='mdi:card-bulleted-settings'
|
|
devClass=
|
|
stClass=
|
|
UoM=
|
|
EnabDef='true'
|
|
ent_cat='diagnostic'
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"enabled_by_default\": \"$EnabDef\", \"entity_category\": \"$ent_cat\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='InvClass'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA device type'
|
|
mdi_icon='mdi:cupboard-outline'
|
|
devClass=
|
|
stClass=
|
|
UoM=
|
|
EnabDef='true'
|
|
ent_cat='diagnostic'
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"enabled_by_default\": \"$EnabDef\", \"entity_category\": \"$ent_cat\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='InvType'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA device Model'
|
|
mdi_icon='mdi:card-bulleted-settings'
|
|
devClass=
|
|
stClass=
|
|
UoM=
|
|
EnabDef='true'
|
|
ent_cat='diagnostic'
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"enabled_by_default\": \"$EnabDef\", \"entity_category\": \"$ent_cat\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='InvSwVer'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA device Firmware'
|
|
mdi_icon=mdi:select-inverse
|
|
devClass=
|
|
stClass=
|
|
UoM=
|
|
EnabDef='true'
|
|
ent_cat='diagnostic'
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"enabled_by_default\": \"$EnabDef\", \"entity_category\": \"$ent_cat\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='InvStatus'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Inverter Status'
|
|
mdi_icon=mdi:select-inverse
|
|
devClass=
|
|
stClass=
|
|
UoM=
|
|
EnabDef='true'
|
|
ent_cat='diagnostic'
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"enabled_by_default\": \"$EnabDef\", \"entity_category\": \"$ent_cat\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='InvTemperature'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Inverter Running Temp'
|
|
mdi_icon='mdi:coolant-temperature'
|
|
devClass='temperature'
|
|
stClass='measurement'
|
|
UoM='°C'
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='InvGridRelay'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA device Grid Relay'
|
|
mdi_icon='mdi:electric-switch'
|
|
devClass=
|
|
stClass=
|
|
UoM=
|
|
EnabDef='false'
|
|
ent_cat='diagnostic'
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"enabled_by_default\": \"$EnabDef\", \"entity_category\": \"$ent_cat\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='EToday'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Energy Daily'
|
|
mdi_icon='mdi:solar-power-variant'
|
|
devClass='energy'
|
|
stClass='total_increasing'
|
|
UoM='kWh'
|
|
EnabDef='true'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='ETotal'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Energy Lifetime'
|
|
mdi_icon='mdi:solar-power-variant'
|
|
devClass='energy'
|
|
stClass='total_increasing'
|
|
UoM='kWh'
|
|
EnabDef='true'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='PACTot'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA AC Power'
|
|
mdi_icon='mdi:solar-power-variant'
|
|
devClass='power'
|
|
stClass='measurement'
|
|
UoM='W'
|
|
EnabDef='true'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='UDC1'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Array UDC'
|
|
mdi_icon='mdi:solar-panel-large'
|
|
devClass='voltage'
|
|
stClass='measurement'
|
|
UoM='V'
|
|
EnabDef='true'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='UDC2'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Array2 UDC'
|
|
mdi_icon='mdi:solar-panel'
|
|
devClass='voltage'
|
|
stClass='measurement'
|
|
UoM='V'
|
|
EnabDef='true'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='IDC1'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Array IDC'
|
|
mdi_icon='mdi:solar-panel-large'
|
|
devClass='current'
|
|
stClass='measurement'
|
|
UoM='A'
|
|
EnabDef='true'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='IDC2'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Array2 IDC'
|
|
mdi_icon='mdi:solar-panel'
|
|
devClass='current'
|
|
stClass='measurement'
|
|
UoM='A'
|
|
EnabDef='true'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='PDC1'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Array PDC'
|
|
mdi_icon='mdi:solar-panel-large'
|
|
devClass='power'
|
|
stClass='measurement'
|
|
UoM='W'
|
|
EnabDef='true'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='PDC2'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Array2 PDC'
|
|
mdi_icon='mdi:solar-panel'
|
|
devClass='power'
|
|
stClass='measurement'
|
|
UoM='W'
|
|
EnabDef='true'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='PDCTot'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA DC All Strings'
|
|
mdi_icon='mdi:solar-power-variant-outline'
|
|
devClass='power'
|
|
stClass='measurement'
|
|
UoM='W'
|
|
EnabDef='true'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='OperTm'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Total Op Time'
|
|
mdi_icon='mdi:clock'
|
|
devClass='duration'
|
|
stClass='total_increasing'
|
|
UoM='h'
|
|
EnabDef='true'
|
|
ent_cat='diagnostic'
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"entity_category\": \"$ent_cat\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='FeedTm'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Total Feed In Time'
|
|
mdi_icon='mdi:clock-digital'
|
|
devClass='duration'
|
|
stClass='total_increasing'
|
|
UoM='h'
|
|
EnabDef='true'
|
|
ent_cat='diagnostic'
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"entity_category\": \"$ent_cat\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='PAC1'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA AC Power Line 1'
|
|
mdi_icon='mdi:transmission-tower'
|
|
devClass='power'
|
|
stClass='measurement'
|
|
UoM='W'
|
|
EnabDef='true'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='PAC2'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA AC Power Line 2'
|
|
mdi_icon='mdi:transmission-tower'
|
|
devClass='power'
|
|
stClass='measurement'
|
|
UoM='W'
|
|
EnabDef='false'
|
|
ent_cat=
|
|
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='PAC3'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA AC Power Line 3'
|
|
mdi_icon='mdi:transmission-tower'
|
|
devClass='power'
|
|
stClass='measurement'
|
|
UoM='W'
|
|
EnabDef='false'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='UAC1'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Grid Phase 1 Voltage'
|
|
mdi_icon='mdi:transmission-tower'
|
|
devClass='voltage'
|
|
stClass='measurement'
|
|
UoM='V'
|
|
EnabDef='true'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='UAC2'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Grid Phase 2 Voltage'
|
|
mdi_icon='mdi:transmission-tower'
|
|
devClass='voltage'
|
|
stClass='measurement'
|
|
UoM='V'
|
|
EnabDef='false'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='UAC3'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Grid Phase 3 Voltage'
|
|
mdi_icon='mdi:transmission-tower'
|
|
devClass='voltage'
|
|
stClass='measurement'
|
|
UoM='V'
|
|
EnabDef='false'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='IAC1'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Grid Phase 1 Current'
|
|
mdi_icon='mdi:transmission-tower'
|
|
devClass='current'
|
|
stClass='measurement'
|
|
UoM='A'
|
|
EnabDef='true'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='IAC2'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Grid Phase 2 Current'
|
|
mdi_icon='mdi:transmission-tower'
|
|
devClass='current'
|
|
stClass='measurement'
|
|
UoM='A'
|
|
EnabDef='false'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='IAC3'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Grid Phase 3 Current'
|
|
mdi_icon='mdi:transmission-tower'
|
|
devClass='current'
|
|
stClass='measurement'
|
|
UoM='A'
|
|
EnabDef='false'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='GridFreq'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Grid Frequency'
|
|
mdi_icon='mdi:transmission-tower'
|
|
devClass='frequency'
|
|
stClass='measurement'
|
|
UoM='Hz'
|
|
EnabDef='true'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='BTSignal'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Bluetooth Signal'
|
|
mdi_icon='mdi:bluetooth'
|
|
devClass='signal_strength'
|
|
stClass='measurement'
|
|
UoM='dB'
|
|
EnabDef='true'
|
|
ent_cat='diagnostic'
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | round(1) | default(0) }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"entity_category\": \"$ent_cat\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='BatTmpVal'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Battery Temp'
|
|
mdi_icon='mdi:home-battery-outline'
|
|
devClass='temperature'
|
|
stClass='measurement'
|
|
UoM='°C'
|
|
EnabDef='false'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='BatVol'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Battery Voltage'
|
|
mdi_icon='mdi:battery-charging-medium'
|
|
devClass='voltage'
|
|
stClass='measurement'
|
|
UoM='V'
|
|
EnabDef='false'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
value='BatAmp'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Battery Current'
|
|
mdi_icon='mdi:battery-charging-medium'
|
|
devClass='current'
|
|
stClass='measurement'
|
|
UoM='A'
|
|
EnabDef='false'
|
|
ent_cat=
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|
|
|
|
#set -x
|
|
value='BatChaStt'
|
|
if [[ " ${array[*]} " =~ " $value " ]]; then
|
|
|
|
describe='SMA Battery Charging'
|
|
mdi_icon='mdi:battery-clock'
|
|
devClass='battery'
|
|
stClass='total'
|
|
UoM='%'
|
|
EnabDef='false'
|
|
ent_cat= ## enabled_by_default boolean (optional, default: true) ##disabled_by # "user"? or null or integration? doesn't work.
|
|
|
|
bashio::log.info Setting Up "$value"
|
|
|
|
/usr/bin/mosquitto_pub -h "$MQTT_Host" -u "$MQTT_User" -P "$MQTT_Pass" -t homeassistant/sensor/sbfspot_"$PLANTNAME"/sbfspot_"$InvSerial""$value"/config -m "{\"name\": \"$describe\", \"state_topic\": \"homeassistant/sbfspot_$PLANTNAME/sbfspot_$InvSerial\", \"value_template\": \"{{ value_json.$value | default() }}\", \"unique_id\": \"$InvSerial"'_'"$value\", \"device_class\": \"$devClass\", \"state_class\": \"$stClass\", \"unit_of_measurement\": \"$UoM\", \"enabled_by_default\": \"$EnabDef\", \"icon\": \"$mdi_icon\", \"device\": { \"identifiers\": [\"$(bashio::addon.name)""-Sensors\"], \"name\": \"HAOS-SBFspot\", \"model\": \"$InvType\", \"manufacturer\": \"SMA\", \"sw_version\": \"$InvSwVer\" }}" "$debugMQTT" "$RoK"
|
|
else
|
|
bashio::log.yellow Skipping "${value}"
|
|
fi
|