diff --git a/docs/MQTT_Topics.md b/docs/MQTT_Topics.md index 404e5e57..4f73b616 100644 --- a/docs/MQTT_Topics.md +++ b/docs/MQTT_Topics.md @@ -24,6 +24,9 @@ serial will be replaced with the serial number of the inverter. | [serial]/device/fwbuilddatetime | R | Build date / time of inverter firmware | | | [serial]/device/hwpartnumber | R | Hardware part number of the inverter | | | [serial]/device/hwversion | R | Hardware version of the inverter | | +| [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]/status/last_update | R | Unix timestamp of last inverter statistics udpate | seconds since JAN 01 1970 (UTC) | ### AC channel / global specific topics @@ -62,8 +65,6 @@ cmd topics are used to set values. Status topics are updated from values set in | ----------------------------------------- | ----- | ---------------------------------------------------- | -------------------------- | | [serial]/status/limit_relative | R | Current applied production limit of the inverter | % of total possible output | | [serial]/status/limit_absolute | R | Current applied production limit of the inverter | Watt (W) | -| [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. The updated value will show up in the web GUI and limit_relative topic immediatly. | % | | [serial]/cmd/limit_persistent_absolute | W | Set the inverter limit as a absolute value. The value will survive the night without power. The updated value will show up in the web GUI and limit_relative topic after around 4 minutes. | 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. The updated value will show up in the web GUI and limit_relative topic immediatly. | % | diff --git a/src/MqttPublishing.cpp b/src/MqttPublishing.cpp index 46819bce..553e2794 100644 --- a/src/MqttPublishing.cpp +++ b/src/MqttPublishing.cpp @@ -70,6 +70,7 @@ void MqttPublishingClass::loop() MqttSettings.publish(subtopic + "/status/reachable", String(inv->isReachable())); MqttSettings.publish(subtopic + "/status/producing", String(inv->isProducing())); + MqttSettings.publish(subtopic + "/status/last_update", String(std::time(0) - (millis() - inv->Statistics()->getLastUpdate()) / 1000)); uint32_t lastUpdate = inv->Statistics()->getLastUpdate(); if (lastUpdate > 0 && lastUpdate != _lastPublishStats[i]) {