Merge branch 'main' into reduce-docker-image-size

This commit is contained in:
bohdan-s
2024-04-05 13:56:59 +11:00
committed by GitHub
7 changed files with 255 additions and 138 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64,linux/arm64 #,linux/arm/v7
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/sungather:${{ steps.version.outputs.tag }},${{ secrets.DOCKERHUB_USERNAME }}/sungather:latest
- uses: "marvinpinto/action-automatic-releases@latest"
+4
View File
@@ -3,6 +3,10 @@ import requests
import datetime
import time
#[16:24:21] INFO: Successfully send discovery information to Home Assistant.
#[16:24:21] INFO: Successfully send service information to the Supervisor.
class export_hassio(object):
def __init__(self):
self.api_base = "http://supervisor/core/api"
+13 -6
View File
@@ -33,7 +33,7 @@ class export_mqtt(object):
logging.info(f"MQTT: Host config is required")
return False
client_id = self.mqtt_config['client_id']
self.mqtt_client = mqtt.Client(client_id)
self.mqtt_client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, client_id)
self.mqtt_client.on_connect = self.on_connect
self.mqtt_client.on_disconnect = self.on_disconnect
self.mqtt_client.on_publish = self.on_publish
@@ -57,13 +57,20 @@ class export_mqtt(object):
return True
def on_connect(self, client, userdata, flags, rc):
logging.info(f"MQTT: Connected to {client._host}:{client._port}")
def on_connect(self, client, userdata, flags, reason_code, properties):
if reason_code == 0:
logging.info(f"MQTT: Connected to {client._host}:{client._port}")
if reason_code > 0:
logging.warn(f"MQTT: FAILED to connect {client._host}:{client._port}")
def on_disconnect(self, client, userdata, rc):
logging.info(f"MQTT: Server Disconnected code: {rc}")
def on_disconnect(self, client, userdata, flags, reason_code, properties):
if reason_code == 0:
logging.info(f"MQTT: Server Disconnected")
if reason_code > 0:
logging.warn(f"MQTT: FAILED to disconnect {reason_code}")
def on_publish(self, client, userdata, mid):
def on_publish(self, client, userdata, mid, reason_codes, properties):
try:
self.mqtt_queue.remove(mid)
except Exception as err:
File diff suppressed because it is too large Load Diff
+7 -2
View File
@@ -19,7 +19,8 @@ def main():
try:
opts, args = getopt.getopt(sys.argv[1:],"hc:r:l:v:", "runonce")
except getopt.GetoptError:
logging.debug(f'No options passed via command line')
sys.exit(f'No options passed via command line, use -h to see all options')
for opt, arg in opts:
if opt == '-h':
@@ -151,7 +152,11 @@ def main():
inverter.checkConnection()
# Scrape the inverter
success = inverter.scrape()
try:
success = inverter.scrape()
except Exception as e:
logging.exception(f"Failed to scrape: {e}")
success = False
if(success):
for export in exports:
+1 -1
View File
@@ -1 +1 @@
__version__ = '0.5.1'
__version__ = '0.5.2'
+4 -4
View File
@@ -1,5 +1,5 @@
PyYAML>=6.0
requests>=2.26.0
paho-mqtt>=1.5.1
PyYAML~=6.0
paho-mqtt~=2.0
requests~=2.0
SungrowClient>=0.1.0
influxdb-client>=1.24.0
influxdb-client~=1.0