Skip to content

BlueAndi/smartmeter

Repository files navigation

smartmeter

A REST API server and MQTT client which provides the power and energy consumption, which uses 2 S0 interfaces. Its the successor project of avr-net-io-smartmeter. Homeassistant MQTT automatic device discovery is supported as well.

License Repo Status Release

Motivation

The idea was to have a simple way to get the power consumption of the heatpump and the rest of the house. The data shall be provided over REST-API and MQTT, as well as to Homeassistant.

Hardware

The Olimex ESP32-POE-ISO board with the RS-232 level shifter Olimex MOD-RS232 is used.

Olimex ESP32-POE-ISO pinout

Deployment

ClassDiagram

Software

ESPHome is used as the base of the software.

Installation

  1. Install Python.
  2. Setup virtual environment.
    python -m venv .venv
  3. Activate virtual environment.
    • Windows CMD: .venv\Scripts\activate.bat
    • Windows PowerShell: .venv\Scripts\activate.ps1
    • Linux: .venv/Scripts/activate
  4. Install packages.
    pip install -r requirements.txt
  5. Create a secrets.yaml in the project root folder. Replace my_user and my_password according to the MQTT broker credentials.
mqtt_user: my_user
mqtt_password: my_password

Build

esphome compile smartmeter.yaml

Flash to target and monitor

esphome run smartmeter.yaml

API Endpoints and MQTT Topics

| **Name**   | **Description** | **REST API**                          | **MQTT Topic**                           |
|------------|-----------------|---------------------------------------|------------------------------------------|
| **s0-1**   | S0-interface    | `http://<IP-ADDRESS>/sensor/s0_1`     | `heatpumpctrl/sensor/s0_1/state`         |
| **s0-2**   | S0-interface    | `http://<IP-ADDRESS>/sensor/s0_2`     | `heatpumpctrl/sensor/s0_2/state`         |

Used Libraries

Library Description License
ESPHome ESPHome MIT and GPLv3

Issues, Ideas And Bugs

If you have further ideas or you found some bugs, great! Create a issue or if you are able and willing to fix it by yourself, clone the repository and create a pull request.

License

The whole source code is published under the MIT license. Consider the different licenses of the used third party libraries too!

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.

About

Smartmeter with S0 input

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published