diff --git a/.idea/AquaMQTT.iml b/.idea/AquaMQTT.iml
new file mode 100644
index 0000000..bc2cd87
--- /dev/null
+++ b/.idea/AquaMQTT.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AquaMQTT/include/message/MainEnergyMessage.h b/AquaMQTT/include/message/MainEnergyMessage.h
index a159dba..f80b8f5 100644
--- a/AquaMQTT/include/message/MainEnergyMessage.h
+++ b/AquaMQTT/include/message/MainEnergyMessage.h
@@ -28,6 +28,8 @@ class MainEnergyMessage
uint16_t powerOverall();
+ uint16_t totalWaterProduction();
+
void compareWith(uint8_t* data);
bool totalHeatpumpHoursChanged() const;
@@ -44,6 +46,8 @@ class MainEnergyMessage
bool powerOverallChanged() const;
+ bool totalWaterProductionChanged() const;
+
private:
uint8_t* mData;
@@ -54,6 +58,7 @@ class MainEnergyMessage
bool mTotalHeatElementHoursChanged;
bool mTotalHoursChanged;
bool mTotalEnergyChanged;
+ bool mTotalWaterProductionChanged;
};
} // namespace message
diff --git a/AquaMQTT/include/mqtt/MQTTDefinitions.h b/AquaMQTT/include/mqtt/MQTTDefinitions.h
index d12e55d..d8450dc 100644
--- a/AquaMQTT/include/mqtt/MQTTDefinitions.h
+++ b/AquaMQTT/include/mqtt/MQTTDefinitions.h
@@ -120,6 +120,7 @@ constexpr char ENERGY_TOTAL_ENERGY_WH[] = { "totalEnergyWh" };
constexpr char ENERGY_POWER_TOTAL[] = { "powerTotal" };
constexpr char ENERGY_POWER_HEAT_ELEMENT[] = { "powerHeatingElem" };
constexpr char ENERGY_POWER_HEATPUMP[] = { "powerHeatpump" };
+constexpr char ENERGY_TOTAL_WATER_PRODUCTION[] = { "totalWaterProduction" };
constexpr char ERROR_ERROR_NUMBER[] = { "errorNumber" };
diff --git a/AquaMQTT/src/message/MainEnergyMessage.cpp b/AquaMQTT/src/message/MainEnergyMessage.cpp
index bd7b9d5..5560f24 100644
--- a/AquaMQTT/src/message/MainEnergyMessage.cpp
+++ b/AquaMQTT/src/message/MainEnergyMessage.cpp
@@ -40,6 +40,12 @@ uint16_t MainEnergyMessage::powerOverall()
{
return ((uint16_t) mData[8] << 8) | (uint16_t) mData[7];
}
+
+uint16_t MainEnergyMessage::totalWaterProduction()
+{
+ return ((uint16_t) mData[10] << 8) | (uint16_t) mData[9];
+}
+
void MainEnergyMessage::compareWith(uint8_t* data)
{
if (data == nullptr)
@@ -51,6 +57,7 @@ void MainEnergyMessage::compareWith(uint8_t* data)
mTotalHeatElementHoursChanged = true;
mTotalHoursChanged = true;
mTotalEnergyChanged = true;
+ mTotalWaterProductionChanged = true;
return;
}
@@ -76,6 +83,10 @@ void MainEnergyMessage::compareWith(uint8_t* data)
case 8:
mPowerOverallChanged = true;
break;
+ case 9:
+ case 10:
+ mTotalWaterProductionChanged = true;
+ break;
case 11:
case 12:
case 13:
@@ -118,6 +129,7 @@ MainEnergyMessage::MainEnergyMessage(uint8_t* data)
, mTotalHeatElementHoursChanged(false)
, mTotalHoursChanged(false)
, mTotalEnergyChanged(false)
+ , mTotalWaterProductionChanged(false)
{
}
bool MainEnergyMessage::totalHeatpumpHoursChanged() const
@@ -148,6 +160,10 @@ bool MainEnergyMessage::powerOverallChanged() const
{
return mPowerOverallChanged;
}
+bool MainEnergyMessage::totalWaterProductionChanged() const
+{
+ return mTotalWaterProductionChanged;
+}
} // namespace message
} // namespace aquamqtt
\ No newline at end of file
diff --git a/AquaMQTT/src/task/MQTTTask.cpp b/AquaMQTT/src/task/MQTTTask.cpp
index e2424cf..eea76e1 100644
--- a/AquaMQTT/src/task/MQTTTask.cpp
+++ b/AquaMQTT/src/task/MQTTTask.cpp
@@ -760,6 +760,10 @@ void MQTTTask::updateEnergyStats(bool fullUpdate)
publishul(ENERGY_SUBTOPIC, ENERGY_POWER_TOTAL, message.powerOverall());
}
+ if(message.totalWaterProductionChanged()) {
+ publishul(ENERGY_SUBTOPIC, ENERGY_TOTAL_WATER_PRODUCTION, message.totalWaterProduction());
+ }
+
if (config::DEBUG_RAW_SERIAL_MESSAGES)
{
sprintf(reinterpret_cast(mTopicBuffer),
diff --git a/MQTT.md b/MQTT.md
index 19997f6..8bf66cc 100644
--- a/MQTT.md
+++ b/MQTT.md
@@ -87,16 +87,17 @@ Using the prefix, the `$root` topic is created, which is `$prefix/aquamqtt/` and
### Energy Message
-| Value | MQTT Topic | Format | Unit | Other Information |
-|-------------------------------|--------------------------------------|--------|------|------------------------------------------------------------------------------------------------------------|
-| Total Heatpump Hours | `$root/energy/totalHeatpumpHours` | uint32 | h | retained |
-| Total Heating Element Hours | `$root/energy/totalHeatingElemHours` | uint32 | h | retained |
-| Total Hours | `$root/energy/totalHours` | uint32 | h | retained |
-| Total Energy | `$root/energy/totalEnergyWh` | uint64 | Wh | |
+| Value | MQTT Topic | Format | Unit | Other Information |
+|-------------------------------|--------------------------------------|--------|------|----------------------------------------------------------------------------------------------------|
+| Total Heatpump Hours | `$root/energy/totalHeatpumpHours` | uint32 | h | retained |
+| Total Heating Element Hours | `$root/energy/totalHeatingElemHours` | uint32 | h | retained |
+| Total Hours | `$root/energy/totalHours` | uint32 | h | retained |
+| Total Energy | `$root/energy/totalEnergyWh` | uint64 | Wh | |
+| Total Water Production | `$root/energy/totalWaterProduction` | uint16 | l | Note: Expected to wrap-around at UINT16_MAX |
| Current Power Heatpump | `$root/energy/powerHeatpump` | uint16 | W | Note: It is possible to define an additional custom mqtt topic for this attribute within `Configuration.h` |
| Current Power Heating Element | `$root/energy/powerHeatingElem` | uint16 | W | Note: It is possible to define an additional custom mqtt topic for this attribute within `Configuration.h` |
-| Current Power Total | `$root/energy/powerTotal` | uint16 | W | |
-| Raw Message (Debug Mode Only) | `$root/energy/debug` | string | | |
+| Current Power Total | `$root/energy/powerTotal` | uint16 | W | |
+| Raw Message (Debug Mode Only) | `$root/energy/debug` | string | | |
### Error Messages
diff --git a/PROTOCOL.md b/PROTOCOL.md
index ed7592f..1c14875 100644
--- a/PROTOCOL.md
+++ b/PROTOCOL.md
@@ -488,8 +488,7 @@ Findings...
| 5 | 0 | ? | - |
| 6 | 0 | ? | - |
| 7 - 8 | 221 1 | Power Consumption Total (Both) | - |
-| 9 | 54 | ? | - |
-| 10 | 215 | ? | - |
+| 9 - 10 | 54 215 | Total Water Production (l) | [Ticket](https://github.com/tspopp/AquaMQTT/issues/30) |
| 11 - 14 | 231 9 0 0 | Total Operation Hours (Heatpump) | - |
| 15 - 18 | 24 0 0 0 | Total Operation Hours (Heating Element) | - |
| 19 - 22 | 231 9 0 0 | Total Operation Hours (Both) | - |
diff --git a/aquamqtt.yaml b/aquamqtt.yaml
index 6d7f029..a851c9b 100644
--- a/aquamqtt.yaml
+++ b/aquamqtt.yaml
@@ -224,6 +224,17 @@ mqtt:
manufacturer: tspopp
name: AquaMQTT
model: V1
+ - name: "Total Water Production"
+ state_topic: "aquamqtt/energy/totalWaterProduction"
+ unit_of_measurement: "l"
+ state_class: total_increasing
+ unique_id: atlantic_state_total_water_production
+ icon: mdi:water-pump
+ device:
+ identifiers: AquaMQTT
+ manufacturer: tspopp
+ name: AquaMQTT
+ model: V1
- name: "Total Heating Element Hours"
state_topic: "aquamqtt/energy/totalHeatingElemHours"
unit_of_measurement: "h"