From 4fe21111737f3617eda89e7fbbf62e7179b9d74d Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Sat, 1 Oct 2022 10:47:19 +0200 Subject: [PATCH] Implemented MQTT topics reachable and producing per inverter --- docs/MQTT_Topics.md | 2 ++ src/MqttPublishing.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/docs/MQTT_Topics.md b/docs/MQTT_Topics.md index 3233748..af3fa51 100644 --- a/docs/MQTT_Topics.md +++ b/docs/MQTT_Topics.md @@ -60,6 +60,8 @@ cmd topics are used to set values. Status topics are updated from values set in | Topic | R / W | Description | Value / Unit | | ----------------------------------------- | ----- | ---------------------------------------------------- | -------------------------- | | [serial]/status/limit_relative | R | Current applied production limit of the inverter | % of total possible output | +| [serial]/status/reachable | R | Indicates whether the inverter is reachable | 0 or 1 | +| [serial]/status/producing | R | Indicates whether the inverter is producing AC power | 0 or 1 | | [serial]/cmd/limit_persistent_relative | W | Set the inverter limit as a percentage of total production capability. The value will survive the night without power | % | | [serial]/cmd/limit_persistent_absolute | W | Set the inverter limit as a absolute value. The value will survive the night without power | Watt (W) | | [serial]/cmd/limit_nonpersistent_relative | W | Set the inverter limit as a percentage of total production capability. The value will reset to the last persistent value at night without power | % | diff --git a/src/MqttPublishing.cpp b/src/MqttPublishing.cpp index 04a9874..902ffaa 100644 --- a/src/MqttPublishing.cpp +++ b/src/MqttPublishing.cpp @@ -66,6 +66,9 @@ void MqttPublishingClass::loop() MqttSettings.publish(subtopic + "/status/limit_relative", String(inv->SystemConfigPara()->getLimitPercent())); } + MqttSettings.publish(subtopic + "/status/reachable", String(inv->isReachable())); + MqttSettings.publish(subtopic + "/status/producing", String(inv->isProducing())); + uint32_t lastUpdate = inv->Statistics()->getLastUpdate(); if (lastUpdate > 0 && lastUpdate != _lastPublishStats[i]) { _lastPublishStats[i] = lastUpdate;