mirror of
https://github.com/alexhopeoconnor/SunGather.git
synced 2026-10-04 02:48:12 +10:00
Sync with upstream: battery_current datatype fix (U16->S16)
- Merged upstream changes from bohdan-s/SunGather - Fixed battery_current register datatype from U16 to S16 for proper negative values - Preserved local VS Code debug configuration - Updated to SunGather v0.5.2
This commit is contained in:
Vendored
+15
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "Build and Push SunGather Docker Image (Multi-Arch)",
|
||||||
|
"type": "shell",
|
||||||
|
"command": "docker buildx build --push --platform linux/amd64,linux/arm64/v8 -t gitea.elixirtechnologies.au/alex/sungather:latest .",
|
||||||
|
"problemMatcher": [],
|
||||||
|
"group": {
|
||||||
|
"kind": "build",
|
||||||
|
"isDefault": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -61,7 +61,24 @@ class export_mqtt(object):
|
|||||||
if reason_code == 0:
|
if reason_code == 0:
|
||||||
logging.info(f"MQTT: Connected to {client._host}:{client._port}")
|
logging.info(f"MQTT: Connected to {client._host}:{client._port}")
|
||||||
if reason_code > 0:
|
if reason_code > 0:
|
||||||
logging.warn(f"MQTT: FAILED to connect {client._host}:{client._port}")
|
reason_messages = {
|
||||||
|
# MQTT 3.1.1
|
||||||
|
1: "Unacceptable Protocol Version",
|
||||||
|
2: "Identifier Rejected",
|
||||||
|
3: "Server Unavailable",
|
||||||
|
4: "Bad Username or Password",
|
||||||
|
5: "Not Authorized",
|
||||||
|
# MQTT 5.0 common
|
||||||
|
128: "Unspecified Error",
|
||||||
|
129: "Malformed Packet",
|
||||||
|
130: "Protocol Error",
|
||||||
|
131: "Implementation Specific Error",
|
||||||
|
135: "Not Authorized",
|
||||||
|
140: "Server Moved",
|
||||||
|
141: "Server Unavailable",
|
||||||
|
}
|
||||||
|
error_message = reason_messages.get(reason_code, "Unknown Error")
|
||||||
|
logging.warning(f"MQTT: FAILED to disconnect (reason {reason_code}): {error_message}")
|
||||||
|
|
||||||
def on_disconnect(self, client, userdata, flags, reason_code, properties):
|
def on_disconnect(self, client, userdata, flags, reason_code, properties):
|
||||||
if reason_code == 0:
|
if reason_code == 0:
|
||||||
|
|||||||
@@ -141,8 +141,10 @@ def main():
|
|||||||
exports.append(getattr(export_load, "export_" + export.get('name'))())
|
exports.append(getattr(export_load, "export_" + export.get('name'))())
|
||||||
retval = exports[-1].configure(export, inverter)
|
retval = exports[-1].configure(export, inverter)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logging.error(f"Failed loading export: {err}" +
|
logging.error(
|
||||||
f"\n\t\t\t Please make sure {export.get('name')}.py exists in the exports folder")
|
f"Failed loading export '{export.get('name')}'",
|
||||||
|
exc_info=True
|
||||||
|
)
|
||||||
|
|
||||||
scan_interval = config_inverter.get('scan_interval')
|
scan_interval = config_inverter.get('scan_interval')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user