Updated the addon with revamped configuration.
Add support for custom MQTT broker
This commit is contained in:
@@ -1,10 +1,39 @@
|
||||
# Grott - Home Assisstant native MQTT integration
|
||||
# Grott - Home Assistant with native MQTT integration
|
||||
|
||||
[](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fegguy%2Fgrott-home-assistant-add-on)
|
||||
|
||||
An addon to allow running the grott software directly on HA.
|
||||
|
||||
This allow to process in local all the data from the growatt shineX key and don't depend on growatt server.
|
||||
This allow to process in local all the data from the growatt datalogger and don't depend on growatt server.
|
||||
|
||||
This addon allow you to have all the entities automatically created.
|
||||
|
||||
## Installation
|
||||
|
||||
1. If you don't have an MQTT broker yet; in Home Assistant go to **Settings → Add-ons → Add-on store** and install the **Mosquitto broker** addon.
|
||||
1. Go back to the **Add-on store**, click **⋮ → Repositories**, fill in</br> `https://github.com/egguy/grott-home-assistant-add-on` and click **Add → Close** or click the **Add repository** button below, click **Add → Close** (You might need to enter the **internal IP address** of your Home Assistant instance first).
|
||||
[](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fegguy%2Fgrott-home-assistant-add-on)
|
||||
3. The repository includes two add-ons:
|
||||
- **grott** is the stable release that tracks the released versions of grott HA plugin.
|
||||
- **grott Edge** tracks the `dev` branch of grott HA plugin such that you can install the edge version if there are features or fixes in the grott HA dev branch that are not yet released. (**recommended for most users**)
|
||||
4. Click on the addon and press **Install** and wait till the addon is installed.
|
||||
5. Click on **Configuration**
|
||||
- If you are **not** using the Mosquitto broker addon fill in your MQTT details (leave empty when using the Mosquitto broker addon). Format is e.g.: <br>
|
||||
|
||||
```yaml
|
||||
host: <IP>
|
||||
port: 1883
|
||||
user: my_user
|
||||
password: my_password
|
||||
```
|
||||
|
||||
- Click **Save**
|
||||
- **Tip:** it is possible to refer to variables in the Home Assistant `secrets.yaml` file by using e.g. `password: '!secret mqtt_pass'`
|
||||
6. If multiple inverters, please refer on how to configure them on this documentation: <https://github.com/johanmeijer/grott/wiki/Multi-Inverter-support>
|
||||
7. Start the addon by going to **Info** and click **Start**
|
||||
8. Configure your data logger using the information contained here: [Rerouting Growatt Wifi TCPIP data via your Grott Server](https://github.com/johanmeijer/grott/wiki/Rerouting-Growatt-Wifi-TCPIP-data-via-your-Grott-Server)
|
||||
- Use the local IP of your home assistant
|
||||
- Don't use a DNS, the datalogger can't resolve `homeassistant.local`
|
||||
|
||||
## contributors
|
||||
|
||||
@@ -13,3 +42,4 @@ Thanks for all the contributors:
|
||||
- [alelio](https://github.com/alelio)
|
||||
- [perico85](https://github.com/perico85)
|
||||
- [crazymonster999](https://github.com/crazymonster999) - Alpha tester
|
||||
- Zigbee2mqtt for the inspiration
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# Changelog
|
||||
|
||||
|
||||
## 0.7
|
||||
|
||||
- Add new options for configuration
|
||||
- Verbose mode
|
||||
- MQTT retain
|
||||
- data path, now you can edit your configuration in /config/grott/grott.ini
|
||||
- Allow custom MQTT broker
|
||||
|
||||
|
||||
## 0.6
|
||||
|
||||
- Updated the branch used by grott
|
||||
|
||||
+23
-27
@@ -1,32 +1,28 @@
|
||||
# Home Assistant Add-on: Grott - The Growatt inverter monitor
|
||||
# Grott - Home Assistant native MQTT integration
|
||||
|
||||
## Installation
|
||||
|
||||
Follow these steps to get the add-on installed on your system:
|
||||
1. If you don't have an MQTT broker yet; in Home Assistant go to **Settings → Add-ons → Add-on store** and install the **Mosquitto broker** addon.
|
||||
1. Go back to the **Add-on store**, click **⋮ → Repositories**, fill in</br> `https://github.com/egguy/grott-home-assistant-add-on` and click **Add → Close** or click the **Add repository** button below, click **Add → Close** (You might need to enter the **internal IP address** of your Home Assistant instance first).
|
||||
[](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fegguy%2Fgrott-home-assistant-add-on)
|
||||
3. The repository includes two add-ons:
|
||||
- **grott** is the stable release that tracks the released versions of grott HA plugin.
|
||||
- **grott Edge** tracks the `dev` branch of grott HA plugin such that you can install the edge version if there are features or fixes in the grott HA dev branch that are not yet released. (**recommended for most users**)
|
||||
4. Click on the addon and press **Install** and wait till the addon is installed.
|
||||
5. Click on **Configuration**
|
||||
- If you are **not** using the Mosquitto broker addon fill in your MQTT details (leave empty when using the Mosquitto broker addon). Format is e.g.: <br>
|
||||
|
||||
1. Navigate in your Home Assistant frontend to **Supervisor** -> **Add-on Store**.
|
||||
2. Find the "Grott" add-on and click it.
|
||||
3. Click on the "INSTALL" button.
|
||||
```yaml
|
||||
host: <IP>
|
||||
port: 1883
|
||||
user: my_user
|
||||
password: my_password
|
||||
```
|
||||
|
||||
## How to use
|
||||
|
||||
The add-on has a couple of options available. To get the add-on running:
|
||||
|
||||
1. Start the add-on.
|
||||
2. Have some patience and wait a couple of minutes.
|
||||
3. Check the add-on log output to see the result.
|
||||
|
||||
## Add-on configuration
|
||||
|
||||
All options from grott are available as options in this add-on. They need to follow the naming convention of the environment variables. Eg:
|
||||
|
||||
```yaml
|
||||
gmode: proxy
|
||||
gnomqtt: False
|
||||
gmqttip: 127.0.0.1
|
||||
gmqttport: 5288
|
||||
gmqttauth: False
|
||||
gmqtttopic: energy/grott
|
||||
gmqttuser: user
|
||||
gmqttpassword: password
|
||||
```
|
||||
- Click **Save**
|
||||
- **Tip:** it is possible to refer to variables in the Home Assistant `secrets.yaml` file by using e.g. `password: '!secret mqtt_pass'`
|
||||
6. If multiple inverters, please refer on how to configure them on this documentation: <https://github.com/johanmeijer/grott/wiki/Multi-Inverter-support>
|
||||
7. Start the addon by going to **Info** and click **Start**
|
||||
8. Configure your data logger using the information contained here: [Rerouting Growatt Wifi TCPIP data via your Grott Server](https://github.com/johanmeijer/grott/wiki/Rerouting-Growatt-Wifi-TCPIP-data-via-your-Grott-Server)
|
||||
- Use the local IP of your home assistant
|
||||
- Don't use a DNS, the datalogger can't resolve `homeassistant.local`
|
||||
@@ -1,4 +1,4 @@
|
||||
# The Growatt Inverter Monitor - HA addon
|
||||
# Grott - Home Assistant native MQTT integration
|
||||
|
||||
This addon allow you to run a local version of grott with the HA plugin and auto discovery enabled.
|
||||
|
||||
|
||||
+16
-17
@@ -1,22 +1,15 @@
|
||||
{
|
||||
"name": "Grott - HA extension - current",
|
||||
"version": "edge-4294033815",
|
||||
"name": "Grott - Home Assistant native MQTT integration - current",
|
||||
"version": "edge-4254266279",
|
||||
"slug": "grott-current",
|
||||
"description": "The Growatt inverter monitor - current HA plugin",
|
||||
"description": "The Growatt inverter monitor with current HA plugin integrated",
|
||||
"url": "https://github.com/egguy/grott-home-assistant-add-on/tree/main/grott-current",
|
||||
"arch": [
|
||||
"armhf",
|
||||
"armv7",
|
||||
"aarch64",
|
||||
"amd64",
|
||||
"i386"
|
||||
],
|
||||
"arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
|
||||
"startup": "application",
|
||||
"services": [
|
||||
"mqtt:need"
|
||||
],
|
||||
"services": ["mqtt:need"],
|
||||
"init": false,
|
||||
"boot": "auto",
|
||||
"map": ["config:rw"],
|
||||
"ports": {
|
||||
"5279/tcp": 5279
|
||||
},
|
||||
@@ -25,10 +18,13 @@
|
||||
},
|
||||
"watchdog": "tcp://[HOST]:[PORT:5279]",
|
||||
"options": {
|
||||
"data_path": "/config/grott",
|
||||
"gmode": "proxy",
|
||||
"gnomqtt": true,
|
||||
"ginvtype": "default",
|
||||
"ginvtypemap": "",
|
||||
"retain": false,
|
||||
"verbose": false,
|
||||
"mqtt": {}
|
||||
},
|
||||
"schema": {
|
||||
@@ -77,12 +73,15 @@
|
||||
"gtime": "str?",
|
||||
"gtimezone": "str?",
|
||||
"gvalueoffset": "int?",
|
||||
"gverbose": "bool?",
|
||||
"verbose": "bool",
|
||||
"retain": "bool",
|
||||
"mqtt": {
|
||||
"server": "str?",
|
||||
"host": "str?",
|
||||
"port": "int?",
|
||||
"user": "str?",
|
||||
"password": "str?"
|
||||
}
|
||||
},
|
||||
"data_path": "str"
|
||||
},
|
||||
"image": "egguy/addon-{arch}-grott-ha-addon-edge"
|
||||
}
|
||||
}
|
||||
|
||||
+94
-42
@@ -1,49 +1,101 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
|
||||
if bashio::config.has_value 'gverbose'; then export gverbose="$(bashio::config 'gverbose')"; fi
|
||||
if bashio::config.has_value 'gminrecl'; then export gminrecl="$(bashio::config 'gminrecl')"; fi
|
||||
if bashio::config.has_value 'gmode'; then export gmode="$(bashio::config 'gmode')"; fi
|
||||
if bashio::config.has_value 'ggrottip'; then export ggrottip="$(bashio::config 'ggrottip')"; fi
|
||||
if bashio::config.has_value 'ggrottport'; then export ggrottport="$(bashio::config 'ggrottport')"; fi
|
||||
if bashio::config.has_value 'gblockcmd'; then export gblockcmd="$(bashio::config 'gblockcmd')"; fi
|
||||
if bashio::config.has_value 'gnoipf'; then export gnoipf="$(bashio::config 'gnoipf')"; fi
|
||||
if bashio::config.has_value 'gtime'; then export gtime="$(bashio::config 'gtime')"; fi
|
||||
if bashio::config.has_value 'gtimezone'; then export gtimezone="$(bashio::config 'gtimezone')"; fi
|
||||
if bashio::config.has_value 'gsendbuf'; then export gsendbuf="$(bashio::config 'gsendbuf')"; fi
|
||||
if bashio::config.has_value 'gcompat'; then export gcompat="$(bashio::config 'gcompat')"; fi
|
||||
if bashio::config.has_value 'gvalueoffset'; then export gvalueoffset="$(bashio::config 'gvalueoffset')"; fi
|
||||
if bashio::config.has_value 'ginverterid'; then export ginverterid="$(bashio::config 'ginverterid')"; fi
|
||||
if bashio::config.has_value 'gincludeall'; then export gincludeall="$(bashio::config 'gincludeall')"; fi
|
||||
if bashio::config.has_value 'ginvtype'; then export ginvtype="$(bashio::config 'ginvtype')"; fi
|
||||
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
|
||||
if bashio::config.has_value 'gmqttauth'; then export gmqttauth="$(bashio::config 'gmqttauth')"; fi
|
||||
if bashio::config.has_value 'gmqttuser'; then export gmqttuser="$(bashio::config 'gmqttuser')"; fi
|
||||
if bashio::config.has_value 'gmqttpassword'; then export gmqttpassword="$(bashio::config 'gmqttpassword')"; fi
|
||||
if bashio::config.has_value 'gpvoutput'; then export gpvoutput="$(bashio::config 'gpvoutput')"; fi
|
||||
if bashio::config.has_value 'gpvapikey'; then export gpvapikey="$(bashio::config 'gpvapikey')"; fi
|
||||
if bashio::config.has_value 'gpvsystemid'; then export gpvsystemid="$(bashio::config 'gpvsystemid')"; fi
|
||||
if bashio::config.has_value 'gpvinverters'; then export gpvinverters="$(bashio::config 'gpvinverters')"; fi
|
||||
if bashio::config.has_value 'ginflux'; then export ginflux="$(bashio::config 'ginflux')"; fi
|
||||
if bashio::config.has_value 'ginflux2'; then export ginflux2="$(bashio::config 'ginflux2')"; fi
|
||||
if bashio::config.has_value 'gifdbname'; then export gifdbname="$(bashio::config 'gifdbname')"; fi
|
||||
if bashio::config.has_value 'gifip'; then export gifip="$(bashio::config 'gifip')"; fi
|
||||
if bashio::config.has_value 'gifport'; then export gifport="$(bashio::config 'gifport')"; fi
|
||||
if bashio::config.has_value 'gifuser'; then export gifuser="$(bashio::config 'gifuser')"; fi
|
||||
if bashio::config.has_value 'gifpassword'; then export gifpassword="$(bashio::config 'gifpassword')"; fi
|
||||
if bashio::config.has_value 'giforg'; then export giforg="$(bashio::config 'giforg')"; fi
|
||||
if bashio::config.has_value 'gifbucket'; then export gifbucket="$(bashio::config 'gifbucket')"; fi
|
||||
if bashio::config.has_value 'giftoken'; then export giftoken="$(bashio::config 'giftoken')"; fi
|
||||
if bashio::config.has_value 'ginvtypemap'; then export ginvtypemap="$(bashio::config 'ginvtypemap')"; fi
|
||||
bashio::log.info "Preparing to start..."
|
||||
|
||||
# Check if HA supervisor started
|
||||
# Workaround for:
|
||||
# - https://github.com/home-assistant/supervisor/issues/3884
|
||||
# - https://github.com/zigbee2mqtt/hassio-zigbee2mqtt/issues/387
|
||||
bashio::config.require 'data_path'
|
||||
|
||||
export DATA_PATH=$(bashio::config 'data_path')
|
||||
if ! bashio::fs.file_exists "$DATA_PATH/grott.ini"; then
|
||||
mkdir -p "$DATA_PATH" || bashio::exit.nok "Could not create $DATA_PATH"
|
||||
|
||||
# Create an empty grott.ini
|
||||
touch "$DATA_PATH/grott.ini"
|
||||
bashio::log.info "Created config directory"
|
||||
|
||||
fi
|
||||
|
||||
if bashio::config.has_value 'verbose'; then
|
||||
# bug in grott code, see: https://github.com/johanmeijer/grott/pull/304
|
||||
export gverbose="$(bashio::config 'verbose')"
|
||||
export verbose="$(bashio::config 'verbose')"
|
||||
fi
|
||||
if bashio::config.has_value 'gminrecl'; then export gminrecl="$(bashio::config 'gminrecl')"; fi
|
||||
if bashio::config.has_value 'gmode'; then export gmode="$(bashio::config 'gmode')"; fi
|
||||
if bashio::config.has_value 'ggrottip'; then export ggrottip="$(bashio::config 'ggrottip')"; fi
|
||||
if bashio::config.has_value 'ggrottport'; then export ggrottport="$(bashio::config 'ggrottport')"; fi
|
||||
if bashio::config.has_value 'gblockcmd'; then export gblockcmd="$(bashio::config 'gblockcmd')"; fi
|
||||
if bashio::config.has_value 'gnoipf'; then export gnoipf="$(bashio::config 'gnoipf')"; fi
|
||||
if bashio::config.has_value 'gtime'; then export gtime="$(bashio::config 'gtime')"; fi
|
||||
if bashio::config.has_value 'gtimezone'; then export gtimezone="$(bashio::config 'gtimezone')"; fi
|
||||
if bashio::config.has_value 'gsendbuf'; then export gsendbuf="$(bashio::config 'gsendbuf')"; fi
|
||||
if bashio::config.has_value 'gcompat'; then export gcompat="$(bashio::config 'gcompat')"; fi
|
||||
if bashio::config.has_value 'gvalueoffset'; then export gvalueoffset="$(bashio::config 'gvalueoffset')"; fi
|
||||
if bashio::config.has_value 'ginverterid'; then export ginverterid="$(bashio::config 'ginverterid')"; fi
|
||||
if bashio::config.has_value 'gincludeall'; then export gincludeall="$(bashio::config 'gincludeall')"; fi
|
||||
if bashio::config.has_value 'ginvtype'; then export ginvtype="$(bashio::config 'ginvtype')"; fi
|
||||
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
|
||||
if bashio::config.has_value 'gmqttauth'; then export gmqttauth="$(bashio::config 'gmqttauth')"; fi
|
||||
if bashio::config.has_value 'gmqttuser'; then export gmqttuser="$(bashio::config 'gmqttuser')"; fi
|
||||
if bashio::config.has_value 'gmqttpassword'; then export gmqttpassword="$(bashio::config 'gmqttpassword')"; fi
|
||||
if bashio::config.has_value 'gpvoutput'; then export gpvoutput="$(bashio::config 'gpvoutput')"; fi
|
||||
if bashio::config.has_value 'gpvapikey'; then export gpvapikey="$(bashio::config 'gpvapikey')"; fi
|
||||
if bashio::config.has_value 'gpvsystemid'; then export gpvsystemid="$(bashio::config 'gpvsystemid')"; fi
|
||||
if bashio::config.has_value 'gpvinverters'; then export gpvinverters="$(bashio::config 'gpvinverters')"; fi
|
||||
if bashio::config.has_value 'ginflux'; then export ginflux="$(bashio::config 'ginflux')"; fi
|
||||
if bashio::config.has_value 'ginflux2'; then export ginflux2="$(bashio::config 'ginflux2')"; fi
|
||||
if bashio::config.has_value 'gifdbname'; then export gifdbname="$(bashio::config 'gifdbname')"; fi
|
||||
if bashio::config.has_value 'gifip'; then export gifip="$(bashio::config 'gifip')"; fi
|
||||
if bashio::config.has_value 'gifport'; then export gifport="$(bashio::config 'gifport')"; fi
|
||||
if bashio::config.has_value 'gifuser'; then export gifuser="$(bashio::config 'gifuser')"; fi
|
||||
if bashio::config.has_value 'gifpassword'; then export gifpassword="$(bashio::config 'gifpassword')"; fi
|
||||
if bashio::config.has_value 'giforg'; then export giforg="$(bashio::config 'giforg')"; fi
|
||||
if bashio::config.has_value 'gifbucket'; then export gifbucket="$(bashio::config 'gifbucket')"; fi
|
||||
if bashio::config.has_value 'giftoken'; then export giftoken="$(bashio::config 'giftoken')"; fi
|
||||
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"
|
||||
export gextvar="{\"ha_mqtt_host\": \"$(bashio::services mqtt "host")\", \"ha_mqtt_port\": \"$(bashio::services mqtt "port")\", \"ha_mqtt_user\": \"$(bashio::services mqtt "username")\", \"ha_mqtt_password\": \"$(bashio::services mqtt "password")\"}"
|
||||
if bashio::config.true 'retain'; then
|
||||
export MQTT_RETAIN="True"
|
||||
else
|
||||
export MQTT_RETAIN="False"
|
||||
fi
|
||||
|
||||
python -u grott.py -v
|
||||
# Expose addon configuration through environment variables.
|
||||
function export_config() {
|
||||
local key=${1}
|
||||
local subkey
|
||||
|
||||
if bashio::config.is_empty "${key}"; then
|
||||
return
|
||||
fi
|
||||
|
||||
for subkey in $(bashio::jq "$(bashio::config "${key}")" 'keys[]'); do
|
||||
export "GROTT_CONFIG_$(bashio::string.upper "${key}")_$(bashio::string.upper "${subkey}")=$(bashio::config "${key}.${subkey}")"
|
||||
done
|
||||
}
|
||||
|
||||
export_config 'mqtt'
|
||||
|
||||
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')"
|
||||
export GROTT_CONFIG_MQTT_USER="$(bashio::services 'mqtt' 'username')"
|
||||
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}"
|
||||
|
||||
python -u grott.py -c "$DATA_PATH/grott.ini"
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
---
|
||||
configuration:
|
||||
gverbose:
|
||||
verbose:
|
||||
name: Verbose mode
|
||||
description: Enable the verbose mode. Useful for debugging
|
||||
retain:
|
||||
name: Activate MQTT retain
|
||||
description: This allow to keep the values between reboot, prevent showing sensor values as unknown
|
||||
gminrecl:
|
||||
name: Minimum record length
|
||||
description: The minimum packet length to be treated
|
||||
|
||||
Reference in New Issue
Block a user