The project interfaces with a Deye electricity inverter and posts telemetry to both InfluxDB and the chosen MQTT topic. You may find my companion project useful which is designed to react to MQTT messages posted by this project. That project is based on the IoT framework Mongoose OS. This application extends my own boilerplate application hosted in docker hub and takes its own git submodule dependency on my own package.
You can find a brief write-up about this project along with a sample InfluxDB dashboard here.
Technologies that help make this package useful:
Also:
Here is some detail about the intended use of this package.
Beyond the Python dependencies defined in the Poetry configuration, the project carries hardcoded dependencies on Sentry and 1Password in order to function.
- 🛑 This project uses 1Password Secrets Automation to store both application key-value pairs as well as runtime secrets. It is assumed that the connect server containers are already running on your environment. If you do not want to use this, then you'll need to fork this package and make the changes as appropriate. It's actually very easy to set up, but note that 1Password is a paid product with a free-tier for secrets automation. Here is an example of how this looks for my application and the generation of the docker-compose.yml relies on this step. Your secrets automation vault must contain an entry called
ENV.inverter_monitor
with these keys:
DEVICE_NAME
: For naming the container. This project usesinverter-monitor
.APP_NAME
: Used for referencing the application's actual name for the logger. This project usesinverter_monitor
.MQTT_SERVER_ADDRESS
: IP address of a network-local MQTT broker to capture some useful telemetry and control for switches.MQTT_TOPIC_PREFIX
: The prefix to be used to disambiguate messages from other sources. This project usesswitch
.INVERTER_LOGGER_ADDRESS
: IP address of a network-local inverter logger device (assuming it's paired to the local network over WiFi).INVERTER_LOGGER_PORT
: IP port number of the logger. This project uses8899
.INVERTER_LOGGER_SN
: Serial number of the logger device. This is usually visible as a sticker on the logger.INFLUXDB_BUCKET
: The configured bucket in InfluxDB that records the telemetry. This project usesinverter
and assumes that an InfluxDB user has been created with permissions to access this bucket.INVERTER_LOGGER_SAMPLE_INTERVAL_SECS
: The sampling interval for the logger. This project uses60
. The logger is slow and does not tolerate overly aggressive polls in that it stops responding or is unable to also post to the web service if you expect the inverter status to be visible online too.WEATHER_COORD
: Numerical coordinates of the solar install in order to equate production with weather conditions. This implementation uses OpenWeather APIs.MQTT_SWITCH_DEVICE_CSV
: The unique identifier of the device. See more in the switch application.OP_CONNECT_SERVER
,OP_CONNECT_TOKEN
,OP_CONNECT_VAULT
: Used to specify the URL of the 1Password connect server with associated client token and Vault ID. See 1Password for more.HC_PING_URL
: Healthchecks URL of this application's current health check status.CRONITOR_MONITOR_KEY
: Token to enable additional health checks presented in Cronitor. This tracks thread count and overall health.
With these configured, you are now able to build the application.
In addition to this, additional runtime configuration is used by the application, and also need to be contained within the secrets vault. With these configured, you are now able to run the application.
- Clone the repo
git clone https://github.com/tailucas/inverter-monitor.git
- Verify that the git submodule is present.
git submodule init git submodule update
- Make the Docker runtime user and set directory permissions. ✋ Be sure to first review the Makefile contents for assumptions around user IDs for Docker.
make user
- Now generate the docker-compose.yml:
make setup
- And generate the Docker image:
make build
- If successful and the local environment is running the 1Password connect containers, run the application. For foreground:
For background:
make run
make rund
Running the application will:
- Connect to the configured inverter logger.
- Connect to the weather service.
- Post associated telemetry to the configured InfluxDB time series database and the configured MQTT broker.
- Will make decisions about switching off consumers based on a crude heuristic.
Distributed under the MIT License. See LICENSE for more information.
- Thank you jlopez77 for providing the Deye Inverter Protocol Translation which was shamelessly lifted for this project. For further adaptations, see the ReadMe of that project.
- Template on which this README is based
- All the Shields