Skip to content

tailucas/inverter-monitor

Repository files navigation

Contributors Forks Stargazers Issues MIT License

About The Project

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.

(back to top)

Built With

Technologies that help make this package useful:

1Password InfluxDB Poetry Python MQTT Sentry ZeroMQ

Also:

(back to top)

Getting Started

Here is some detail about the intended use of this package.

Prerequisites

Beyond the Python dependencies defined in the Poetry configuration, the project carries hardcoded dependencies on Sentry and 1Password in order to function.

Installation

  1. 🛑 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 uses inverter-monitor.
  • APP_NAME: Used for referencing the application's actual name for the logger. This project uses inverter_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 uses switch.
  • 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 uses 8899.
  • 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 uses inverter 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 uses 60. 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.

  1. Clone the repo
    git clone https://github.com/tailucas/inverter-monitor.git
  2. Verify that the git submodule is present.
    git submodule init
    git submodule update
  3. 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
  4. Now generate the docker-compose.yml:
    make setup
  5. And generate the Docker image:
    make build
  6. If successful and the local environment is running the 1Password connect containers, run the application. For foreground:
    make run
    For background:
    make rund

(back to top)

Usage

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.

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Acknowledgments

(back to top)

Hits

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published