Skip to content

Commit

Permalink
Quick fix to MQTT publish messages
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdan-s committed Jan 25, 2022
1 parent 295944d commit 9e7a926
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,27 @@ Has multiple export locations out of the box:
* PVOutput - Load into PVOutput.org
* InfluxDB - Load data directly into InfluxDB
* Simple webserver showing collected data
* Rasberry Pi Docker support
* and more coming....

I have borrowed HEAVILY from the following projects, THANK YOU
I have learned a lot from the following projects, THANK YOU
* [solariot](https://github.com/meltaxa/solariot)
* [modbus4mqtt](https://github.com/tjhowse/modbus4mqtt)
* [ModbusTCP2MQTT](https://github.com/TenySmart/ModbusTCP2MQTT)

<p align="right">(<a href="#top">back to top</a>)</p>

## Raodmap / TO DO
* Rasberry Pi Docker support
* Full Home Assistant integration, as HACS addon


## Updates
**0.3.0**
**IMPORTANT: If updating from v0.1.x or v0.2.x please check config against config-example. some options for MQTT and PVOutput have changed**
* Heaps bug fixes
* Fixed PVOutput not working after midnight
* MQTT now auto-reconnects
* MQTT/PVOutput now verify values exist before trying to publish
* Rasberry Pi Docker support
* lots more...


Expand Down Expand Up @@ -261,11 +261,19 @@ SH5K-20, SH3K6, SH4K6, SH5K-V13, SH5K-30, SH3K6-30, SH4K6-30, SH5.0RS, SH3.6RS,


## Building
Multi Arch (BuildX) Including Raspberry Pi
```sh
docker run --privileged --rm tonistiigi/binfmt --install all
docker buildx create --platform linux/amd64,linux/arm64/v8 --use
docker buildx build --push --platform linux/amd64,linux/arm64/v8 -t bohdans/sungather:latest -t bohdans/sungather:v<version> .
```
Current Arch (docker build)
```sh
docker build --no-cache --rm -t bohdans/sungather:latest -t bohdans/sungather:v<version> .
docker push bohdans/sungather -a
```


<p align="right">(<a href="#top">back to top</a>)</p>
<!-- LICENSE -->
## License
Expand Down
5 changes: 3 additions & 2 deletions SunGather/exports/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ def on_disconnect(self, client, userdata, rc):
logging.info(f"MQTT: Server Disconnected code: {rc}")

def on_publish(self, client, userdata, mid):
self.mqtt_queue.remove(mid)
logging.info(f"MQTT: Message {mid} Published")
if mid:
self.mqtt_queue.remove(mid)
logging.info(f"MQTT: Message {mid} Published")

def cleanName(self, name):
return name.lower().replace(' ','_')
Expand Down

0 comments on commit 9e7a926

Please sign in to comment.