Skip to content

Commit

Permalink
Merge pull request #75 from matthias882/main
Browse files Browse the repository at this point in the history
Inverter power and thermal power requirement decoded
  • Loading branch information
lanwin authored Feb 6, 2024
2 parents 0295991 + 2665a76 commit 21a5710
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
30 changes: 30 additions & 0 deletions components/samsung_ac/protocol_non_nasa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ namespace esphome
return str;
}

std::string NonNasaCommandF3::to_string()
{
std::string str;
str += "inverter_max_frequency[Hz]:" + std::to_string(inverter_max_frequency_hz) + ";";
str += "inverter_total_capacity_requirement[kW]:" + std::to_string(inverter_total_capacity_requirement_kw) + ";";
str += "inverter_current[ADC]:" + std::to_string(inverter_current_a) + ";";
str += "inverter_voltage[VDC]:" + std::to_string(inverter_voltage_v) + ";";
str += "inverter_power[W]:" + std::to_string(inverter_power_w) + ";";
return str;
}

std::string NonNasaDataPacket::to_string()
{
std::string str;
Expand All @@ -58,6 +69,11 @@ namespace esphome
str += "commandC6:{" + commandC6.to_string() + "}";
break;
}
case NonNasaCommand::CmdF3:
{
str += "commandF3:{" + commandF3.to_string() + "}";
break;
}
case NonNasaCommand::CmdF8:
{
str += "commandF8:{" + commandF8.to_string() + "}";
Expand Down Expand Up @@ -120,6 +136,20 @@ namespace esphome
commandC6.control_status = data[4];
return DecodeResult::Ok;
}
case NonNasaCommand::CmdF3: // power consumption
{
// Maximum frequency for Inverter (compressor-motor of outdoor-unit) in Hz
commandF3.inverter_max_frequency_hz = data[4];
// Sum of required heating/cooling capacity ordered by the indoor-units in kW
commandF3.inverter_total_capacity_requirement_kw = (float)data[5] / 10;
// DC-current to the inverter of outdoor-unit in A
commandF3.inverter_current_a = (float)data[8] / 10;
// voltage of the DC-link to inverter in V
commandF3.inverter_voltage_v = (float)data[9] * 2;
//Power consumption of the outdoo unit inverter in W
commandF3.inverter_power_w = commandF3.inverter_current_a * commandF3.inverter_voltage_v;
return DecodeResult::Ok;
}
default:
{
commandRaw.length = data.size() - 4 - 1;
Expand Down
14 changes: 14 additions & 0 deletions components/samsung_ac/protocol_non_nasa.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ namespace esphome
};
};

struct NonNasaCommandF3
{
uint8_t inverter_max_frequency_hz = 0;
float inverter_total_capacity_requirement_kw = 0;
float inverter_current_a = 0;
float inverter_voltage_v = 0;
float inverter_power_w = 0;

std::string to_string();
};


struct NonNasaCommandRaw
{
uint8_t length;
Expand All @@ -78,6 +90,7 @@ namespace esphome
{
Cmd20 = 0x20,
CmdC6 = 0xc6,
CmdF3 = 0xf3,
CmdF8 = 0xF8,
};

Expand All @@ -96,6 +109,7 @@ namespace esphome
{
NonNasaCommand20 command20;
NonNasaCommandC6 commandC6;
NonNasaCommandF3 commandF3;
NonNasaCommandRaw commandF8; // Unknown structure for now
NonNasaCommandRaw commandRaw;
};
Expand Down

0 comments on commit 21a5710

Please sign in to comment.