Skip to content

Commit

Permalink
Try to fix up zone2 room temperature reporting (issue rbroker#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbroker committed Mar 9, 2024
1 parent 8b523ed commit 533ef5f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
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.6");
return FPSTR("v0.1.7");
}

} // namespace ehal
5 changes: 4 additions & 1 deletion ecodan-ha-local/ehal_hp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,10 @@ namespace ehal::hp
break;
case GetType::SH_TEMPERATURE_STATE:
status.Zone1RoomTemperature = res.get_float16(1);
status.Zone2RoomTemperature = res.get_float16(7);
if (res.get_u16(3) != 0xF0C4) // 0xF0C4 seems to be a sentinel value for "not reported in the current system"
status.Zone2RoomTemperature = res.get_float16(3);
else
status.Zone2RoomTemperature = 0.0f;
status.OutsideTemperature = res.get_float8(11);
break;
case GetType::DHW_TEMPERATURE_STATE_A:
Expand Down
10 changes: 9 additions & 1 deletion ecodan-ha-local/ehal_mqtt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -905,11 +905,17 @@ off

if (!publish_ha_float_sensor_auto_discover(F("z1_flow_temp_target"), SensorType::TEMPERATURE))
anyFailed = true;

if (!publish_ha_float_sensor_auto_discover(F("z1_room_temp_target"), SensorType::TEMPERATURE))
anyFailed = true;

if (!publish_ha_float_sensor_auto_discover(F("z2_room_temp"), SensorType::TEMPERATURE))
anyFailed = true;

if (!publish_ha_float_sensor_auto_discover(F("z2_flow_temp_target"), SensorType::TEMPERATURE))
anyFailed = true;

if (!publish_ha_float_sensor_auto_discover(F("z2_room_temp"), SensorType::TEMPERATURE))
if (!publish_ha_float_sensor_auto_discover(F("z2_room_temp_target"), SensorType::TEMPERATURE))
anyFailed = true;

if (!publish_ha_float_sensor_auto_discover(F("dhw_temp"), SensorType::TEMPERATURE))
Expand Down Expand Up @@ -1000,8 +1006,10 @@ off
publish_sensor_status<float>(F("dhw_delivered"), status.EnergyDeliveredDhw);
publish_sensor_status<float>(F("z1_room_temp"), status.Zone1RoomTemperature);
publish_sensor_status<float>(F("z1_flow_temp_target"), status.Zone1FlowTemperatureSetPoint);
publish_sensor_status<float>(F("z1_room_temp_target"), status.Zone1SetTemperature);
publish_sensor_status<float>(F("z2_room_temp"), status.Zone2RoomTemperature);
publish_sensor_status<float>(F("z2_flow_temp_target"), status.Zone2FlowTemperatureSetPoint);
publish_sensor_status<float>(F("z2_room_temp_target"), status.Zone2SetTemperature);
publish_sensor_status<float>(F("dhw_temp"), status.DhwTemperature);
publish_sensor_status<float>(F("dhw_cop"), status.EnergyConsumedDhw > 0.0f ? status.EnergyDeliveredDhw / status.EnergyConsumedDhw : 0.0f);
publish_sensor_status<float>(F("sh_cop"), status.EnergyConsumedHeating > 0.0f ? status.EnergyDeliveredHeating / status.EnergyConsumedHeating : 0.0f);
Expand Down
7 changes: 6 additions & 1 deletion ecodan-ha-local/ehal_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace ehal::hp
MODE_FLAGS_B = 0x28,
ENERGY_USAGE = 0xA1,
ENERGY_DELIVERY = 0xA2
};
};

const uint8_t HEADER_SIZE = 5;
const uint8_t PAYLOAD_SIZE = 16;
Expand Down Expand Up @@ -274,6 +274,11 @@ namespace ehal::hp
return (value - 80.0f);
}

uint16_t get_u16(size_t index)
{
return uint16_t(payload()[index] << 8) | payload()[index + 1];
}

void set_float16(float value, size_t index)
{
uint16_t u16 = uint16_t(value * 100.0f);
Expand Down

0 comments on commit 533ef5f

Please sign in to comment.