Skip to content

Commit

Permalink
Support request from issue rbroker#22, energy metrics for cooling
Browse files Browse the repository at this point in the history
  • Loading branch information
rbroker committed Mar 9, 2024
1 parent 71ebf65 commit 8b523ed
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ecodan-ha-local/ehal_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ namespace ehal

String get_software_version()
{
return FPSTR("v0.1.5");
return FPSTR("v0.1.6");
}

} // namespace ehal
2 changes: 2 additions & 0 deletions ecodan-ha-local/ehal_hp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,12 @@ namespace ehal::hp
break;
case GetType::ENERGY_USAGE:
status.EnergyConsumedHeating = res.get_float24(4);
status.EnergyConsumedCooling = res.get_float24(7);
status.EnergyConsumedDhw = res.get_float24(10);
break;
case GetType::ENERGY_DELIVERY:
status.EnergyDeliveredHeating = res.get_float24(4);
status.EnergyDeliveredCooling = res.get_float24(7);
status.EnergyDeliveredDhw = res.get_float24(10);
break;
default:
Expand Down
2 changes: 2 additions & 0 deletions ecodan-ha-local/ehal_hp.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ namespace ehal::hp
// Efficiency
uint8_t CompressorFrequency;
float EnergyConsumedHeating;
float EnergyConsumedCooling;
float EnergyDeliveredHeating;
float EnergyDeliveredCooling;
float EnergyConsumedDhw;
float EnergyDeliveredDhw;

Expand Down
4 changes: 4 additions & 0 deletions ecodan-ha-local/ehal_html.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ namespace ehal
<td>Space Heating:</td>
<td>{{sh_consumed}}kWh &rarr; {{sh_delivered}}kWh (COP: {{sh_cop}})</td>
</tr>
<tr>
<td>Cooling:</td>
<td>{{cool_consumed}}kWh &rarr; {{cool_delivered}}kWh (COP: {{cool_cop}})</td>
</tr>
<tr>
<td>DHW:</td>
<td>{{dhw_consumed}}kWh &rarr; {{dhw_delivered}}kWh (COP: {{dhw_cop}})</td>
Expand Down
7 changes: 7 additions & 0 deletions ecodan-ha-local/ehal_http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,13 @@ namespace ehal::http
else
page.replace(F("{{sh_cop}}"), "0.00");

page.replace(F("{{cool_consumed}}"), String(status.EnergyConsumedCooling));
page.replace(F("{{cool_delivered}}"), String(status.EnergyDeliveredCooling));
if (status.EnergyConsumedCooling > 0.0f)
page.replace(F("{{cool_cop}}"), String(status.EnergyDeliveredCooling / status.EnergyConsumedCooling));
else
page.replace(F("{{cool_cop}}"), "0.00");

page.replace(F("{{dhw_consumed}}"), String(status.EnergyConsumedDhw));
page.replace(F("{{dhw_delivered}}"), String(status.EnergyDeliveredDhw));
if (status.EnergyConsumedDhw > 0.0f)
Expand Down
8 changes: 8 additions & 0 deletions ecodan-ha-local/ehal_mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,12 @@ off
if (!publish_ha_float_sensor_auto_discover(F("heating_delivered"), SensorType::POWER))
anyFailed = true;

if (!publish_ha_float_sensor_auto_discover(F("cooling_consumed"), SensorType::POWER))
anyFailed = true;

if (!publish_ha_float_sensor_auto_discover(F("cooling_delivered"), SensorType::POWER))
anyFailed = true;

if (!publish_ha_float_sensor_auto_discover(F("dhw_consumed"), SensorType::POWER))
anyFailed = true;

Expand Down Expand Up @@ -988,6 +994,8 @@ off
publish_sensor_status<String>(F("mode_heating_cooling"), status.hp_mode_as_string());
publish_sensor_status<float>(F("heating_consumed"), status.EnergyConsumedHeating);
publish_sensor_status<float>(F("heating_delivered"), status.EnergyDeliveredHeating);
publish_sensor_status<float>(F("cooling_consumed"), status.EnergyConsumedCooling);
publish_sensor_status<float>(F("cooling_delivered"), status.EnergyDeliveredCooling);
publish_sensor_status<float>(F("dhw_consumed"), status.EnergyConsumedDhw);
publish_sensor_status<float>(F("dhw_delivered"), status.EnergyDeliveredDhw);
publish_sensor_status<float>(F("z1_room_temp"), status.Zone1RoomTemperature);
Expand Down

0 comments on commit 8b523ed

Please sign in to comment.