Skip to content

Commit

Permalink
Added sensors for monitoring outdoor unit energy metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
omerfaruk-aran committed Oct 29, 2024
1 parent f582b63 commit 53f471e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions components/samsung_ac/protocol_non_nasa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,28 @@ namespace esphome
target->set_outdoor_temperature(nonpacket_.src, nonpacket_.commandC0.outdoor_unit_outdoor_temp_c);
}
}
else if (nonpacket_.cmd == NonNasaCommand::CmdF3)
{
// Add checks to ensure pending messages are not overwritten
bool pending_control_message = false;
for (auto &item : nonnasa_requests)
{
if (item.time_sent > 0 && nonpacket_.src == item.request.dst)
{
pending_control_message = true;
break;
}
}

if (!pending_control_message)
{
// Publish power energy if there are no pending control messages
target->set_outdoor_instantaneous_power(nonpacket_.src, nonpacket_.commandF3.inverter_power_w);
target->set_outdoor_cumulative_energy(nonpacket_.src, nonpacket_.commandF3.inverter_total_capacity_requirement_kw);
target->set_outdoor_current(nonpacket_.src, nonpacket_.commandF3.inverter_current_a);
target->set_outdoor_voltage(nonpacket_.src, nonpacket_.commandF3.inverter_voltage_v);
}
}
}

void NonNasaProtocol::protocol_update(MessageTarget *target)
Expand Down

0 comments on commit 53f471e

Please sign in to comment.