Allow integration with grott integration
Updated the script + configuration to allow disabling the extension and auto configure the MQTT.
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
# Changelog
|
||||
|
||||
## 0.8
|
||||
|
||||
Added and option to improve compatibility with [grott homeassistant integration](https://github.com/muppet3000/homeassistant-grott).
|
||||
|
||||
To activate this mode, you can disable the HA integration in the configuration and enable the grott_mqtt flag. This will configure the MQTT for pushing information through the grott MQTT exporter.
|
||||
|
||||
## 0.7
|
||||
|
||||
|
||||
@@ -30,11 +30,12 @@
|
||||
"options": {
|
||||
"data_path": "/config/grott",
|
||||
"gmode": "proxy",
|
||||
"gnomqtt": true,
|
||||
"grott_mqtt": false,
|
||||
"ginvtype": "default",
|
||||
"ginvtypemap": "",
|
||||
"retain": false,
|
||||
"verbose": false,
|
||||
"ha_plugin": true,
|
||||
"mqtt": {}
|
||||
},
|
||||
"schema": {
|
||||
@@ -72,7 +73,7 @@
|
||||
"gmqtttopic": "str?",
|
||||
"gmqttuser": "str?",
|
||||
"gnoipf": "bool?",
|
||||
"gnomqtt": "bool?",
|
||||
"grott_mqtt": "bool?",
|
||||
"gpvapikey": "str?",
|
||||
"gpvdisv1": "bool?",
|
||||
"gpvinverters": "int?",
|
||||
@@ -85,6 +86,7 @@
|
||||
"gvalueoffset": "int?",
|
||||
"verbose": "bool",
|
||||
"retain": "bool",
|
||||
"ha_plugin": "bool",
|
||||
"mqtt": {
|
||||
"host": "str?",
|
||||
"port": "int?",
|
||||
|
||||
+29
-5
@@ -40,7 +40,6 @@ if bashio::config.has_value 'ginvtype'; then export ginvtype="$(bashio::config '
|
||||
if bashio::config.has_value 'gdecrypt'; then export gdecrypt="$(bashio::config 'gdecrypt')"; fi
|
||||
if bashio::config.has_value 'ggrowattip'; then export ggrowattip="$(bashio::config 'ggrowattip')"; fi
|
||||
if bashio::config.has_value 'ggrowattport'; then export ggrowattport="$(bashio::config 'ggrowattport')"; fi
|
||||
if bashio::config.has_value 'gnomqtt'; then export gnomqtt="$(bashio::config 'gnomqtt')"; fi
|
||||
if bashio::config.has_value 'gmqttip'; then export gmqttip="$(bashio::config 'gmqttip')"; fi
|
||||
if bashio::config.has_value 'gmqttport'; then export gmqttport="$(bashio::config 'gmqttport')"; fi
|
||||
if bashio::config.has_value 'gmqtttopic'; then export gmqtttopic="$(bashio::config 'gmqtttopic')"; fi
|
||||
@@ -64,9 +63,15 @@ if bashio::config.has_value 'giftoken'; then export giftoken="$(bashio::config '
|
||||
if bashio::config.has_value 'ginvtypemap'; then export ginvtypemap="$(bashio::config 'ginvtypemap')"; fi
|
||||
if bashio::config.has_value 'gpvdisv1'; then export gpvdisv1="$(bashio::config 'gpvdisv1')"; fi
|
||||
|
||||
# pre configure the extension to use the integrated mosquitto broker
|
||||
export gextension="True"
|
||||
export gextname="grott_ha"
|
||||
if bashio::config.has_value 'grott_mqtt'; then
|
||||
if bashio::config.true 'grott_mqtt'; then
|
||||
export gnomqtt="False";
|
||||
else
|
||||
export gnomqtt="True";
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if bashio::config.true 'retain'; then
|
||||
export MQTT_RETAIN="True"
|
||||
else
|
||||
@@ -89,6 +94,7 @@ function export_config() {
|
||||
|
||||
export_config 'mqtt'
|
||||
|
||||
# If the mqtt block is empty, but the mqtt service exists, use that.
|
||||
if bashio::config.is_empty 'mqtt' && bashio::var.has_value "$(bashio::services 'mqtt')"; then
|
||||
export GROTT_CONFIG_MQTT_HOST="$(bashio::services 'mqtt' 'host')"
|
||||
export GROTT_CONFIG_MQTT_PORT="$(bashio::services 'mqtt' 'port')"
|
||||
@@ -96,6 +102,24 @@ if bashio::config.is_empty 'mqtt' && bashio::var.has_value "$(bashio::services '
|
||||
export GROTT_CONFIG_MQTT_PASSWORD="$(bashio::services 'mqtt' 'password')"
|
||||
fi
|
||||
|
||||
export gextvar="{\"ha_mqtt_host\": \"$GROTT_CONFIG_MQTT_HOST\", \"ha_mqtt_port\": \"$GROTT_CONFIG_MQTT_PORT\", \"ha_mqtt_user\": \"$GROTT_CONFIG_MQTT_USER\", \"ha_mqtt_password\": \"$GROTT_CONFIG_MQTT_PASSWORD\", \"ha_mqtt_retain\": $MQTT_RETAIN}"
|
||||
if bashio::config.true 'ha_plugin'; then
|
||||
# pre configure the extension to use the integrated mosquitto broker
|
||||
export gextension="True"
|
||||
export gextname="grott_ha"
|
||||
export gextvar="{\"ha_mqtt_host\": \"$GROTT_CONFIG_MQTT_HOST\", \"ha_mqtt_port\": \"$GROTT_CONFIG_MQTT_PORT\", \"ha_mqtt_user\": \"$GROTT_CONFIG_MQTT_USER\", \"ha_mqtt_password\": \"$GROTT_CONFIG_MQTT_PASSWORD\", \"ha_mqtt_retain\": $MQTT_RETAIN}"
|
||||
fi
|
||||
|
||||
# Auto configure the MQTT output if enabled
|
||||
if bashio::config.true 'grott_mqtt'; then
|
||||
# if using the addon we are required to put an IP, we can't use a DNS
|
||||
if bashio::var.has_value "$(bashio::services 'mqtt')"; then
|
||||
export GROTT_CONFIG_MQTT_HOST="$(dig $GROTT_CONFIG_MQTT_HOST +short)";
|
||||
fi
|
||||
export gmqttauth="True"
|
||||
export gmqttip="$GROTT_CONFIG_MQTT_HOST";
|
||||
export gmqttport="$GROTT_CONFIG_MQTT_PORT";
|
||||
export gmqttuser="$GROTT_CONFIG_MQTT_USER";
|
||||
export gmqttpassword="$GROTT_CONFIG_MQTT_PASSWORD"
|
||||
fi
|
||||
|
||||
python -u grott.py -c "$DATA_PATH/grott.ini"
|
||||
|
||||
@@ -9,15 +9,18 @@ configuration:
|
||||
gminrecl:
|
||||
name: Minimum record length
|
||||
description: The minimum packet length to be treated
|
||||
gnomqtt:
|
||||
name: Disable grott MQTT
|
||||
description: Prevent grott from sending MQTT Message, the add-on has it own MQTT messaging, so this configuration is not required.
|
||||
grott_mqtt:
|
||||
name: Enable grott MQTT
|
||||
description: Allow grott to send MQTT messages. If your are using the grott_ha extension, you don't need this. If you are using the grott integration,m you need to enable it.
|
||||
ginvtype:
|
||||
name: Inverter type
|
||||
description: "For changing the layout used for decoding (ex: sph, spf or tl3). Keep it on default if using inverter map."
|
||||
ginvtypemap:
|
||||
name: Inverter mapping
|
||||
description: 'An inverter mapping in the form {"SERIAL": "type"} e.g.: for an SPH6000 with serial "NWO00415E3" : {"NWO00415E3": "sph"}'
|
||||
ha_plugin:
|
||||
name: Home Assistant plugin
|
||||
description: "Enable the Home Assistant plugin. This will send the data to Home Assistant via the grott HA plugin. Can be disabled if you are using the grott integration."
|
||||
|
||||
network:
|
||||
5279/TCP: This is the port used by grott to receive datalogger information.
|
||||
Reference in New Issue
Block a user