Get values from modbus energy meter to MQTT / HomeAssistant
Project description
energymeter2mqtt
Get values from modbus energy meter to MQTT / HomeAssistant
Energy Meter -> modbus -> RS485-USB-Adapter -> energymeter2mqtt -> MQTT -> Home Assistant
The current focus is on the energy meter "Saia PCD ALD1D5FD" However, the code is kept flexible, so that similar meters can be quickly put into operation.
Quick start
Overview:
- Clone the sources
- Create your config:
./cli.py edit-settings
- Test:
./cli.py print-values
- Setup and start MQTT publishing:
sudo ./cli.py systemd-setup
~$ git clone https://github.com/jedie/energymeter2mqtt.git
~$ cd energymeter2mqtt
~/energymeter2mqtt$ ./dev-cli.py --help
Usage: ./cli.py [OPTIONS] COMMAND [ARGS]...
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────╮
│ debug-settings Display (anonymized) MQTT server username and password │
│ edit-settings Edit the settings file. On first call: Create the default one. │
│ print-registers Print RAW modbus register data │
│ print-values Print all values from the definition in endless loop │
│ publish-loop Publish all values via MQTT to Home Assistant in a endless loop. │
│ systemd-debug Print Systemd service template + context + rendered file content. │
│ systemd-remove Stops the systemd service and removed the service file. (May need sudo) │
│ systemd-setup Write Systemd service file, enable it and (re-)start the service. (May need │
│ sudo) │
│ systemd-status Display status of systemd service. (May need sudo) │
│ systemd-stop Stops the systemd service. (May need sudo) │
│ version Print version and exit │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
start development
~$ git clone https://github.com/jedie/energymeter2mqtt.git
~$ cd energymeter2mqtt
~/energymeter2mqtt$ ./dev-cli.py --help
dev CLI
Usage: ./dev-cli.py [OPTIONS] COMMAND [ARGS]...
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────╮
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────╮
│ check-code-style Check code style by calling darker + flake8 │
│ coverage Run and show coverage. │
│ create-default-settings Create a default user settings file. (Used by CI pipeline ;) │
│ fix-code-style Fix code style of all inverter source code files via darker │
│ install Run pip-sync and install 'inverter' via pip as editable. │
│ mypy Run Mypy (configured in pyproject.toml) │
│ publish Build and upload this project to PyPi │
│ safety Run safety check against current requirements files │
│ test Run unittests │
│ tox Run tox │
│ update Update "requirements*.txt" dependencies files │
│ update-test-snapshot-files Update all test snapshot files (by remove and recreate all snapshot │
│ files) │
│ version Print version and exit │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
energymeter2mqtt-0.1.1.tar.gz
(43.4 kB
view details)
Built Distribution
File details
Details for the file energymeter2mqtt-0.1.1.tar.gz
.
File metadata
- Download URL: energymeter2mqtt-0.1.1.tar.gz
- Upload date:
- Size: 43.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 402a48f59823b27fcaaf1ba0449f0393a32eb6f8913070eeafd7688b1b7cc06e |
|
MD5 | 52e4568daad5cf2833466aebbc20af73 |
|
BLAKE2b-256 | 5f6b0f26b651a803190773cc8985f789838b0989d73ac5c546a1362d19341216 |
Provenance
File details
Details for the file energymeter2mqtt-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: energymeter2mqtt-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cda3e77d8547696f58181ff51f44fd8a304a96db67895da0d2ac18f4cfb703b6 |
|
MD5 | c7a4719a6cf141b0fecad72eb9aec9ae |
|
BLAKE2b-256 | 60bac11481a2e633fd2661875c44c697e43380923564bde9bbbae3a31cfcf0d1 |