Skip to content
This repository was archived by the owner on May 31, 2026. It is now read-only.

MQTT Publishing#84

Open
capi wants to merge 4 commits into
nmakel:masterfrom
capi:mqtt-publisher
Open

MQTT Publishing#84
capi wants to merge 4 commits into
nmakel:masterfrom
capi:mqtt-publisher

Conversation

@capi
Copy link
Copy Markdown
Contributor

@capi capi commented Sep 6, 2023

Based on the initial example script by @jburdy in #66, improved a bit on the stability of the MQTT publishing and added a possibility to have the script "loop" forever, so that it can be used as part of a systemd service or a Docker deployment without the repeated overhead of starting up the Python runtime.

Note that the script will currently still "crash" while in --loop if anything goes wrong with reading the data. So it is sensible to have the calling service or wrapper re-start it in a loop. I personally use it in a Docker file like this:

version: "3.4"
services:
  solaredge-modbus-mqtt-publisher:
    image: cr.my.domain/solaredge_modbus:latest
    restart: unless-stopped
    entrypoint: [ "/bin/bash", "-c", "while true; do ./modbus-to-mqtt.py --loop --loop_delay 3 --mqttHost 192.168.38.1 --mqttBaseTopic solaredge/ 192.168.38.90 502; sleep 3; done" ]

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants