In this code which should return some inverter errors I noticed that when the battery is low, the code rightly returns ID124 BatLowVoltageAlarm but together with ID116 VoltDerating, which is not true. Where is the error?
- platform: modbus_controller ## Inverter Fault Message ##
modbus_controller_id: zcs ## Fault 8 ##
name: Errore Inverter
id: inverter_fault_8
register_type: holding
address: 0x040C
skip_updates: 20
response_size: 2
lambda: |-
std::string z = "";
int idx = item->offset;
//byte[0]
if ((data[idx] & 0x1) != 0) z += "ID113 OverTempDerating,";
if ((data[idx] & 0x2) != 0) z += "ID114 FreqDerating,";
if ((data[idx] & 0x4) != 0) z += "ID115 FreqLoading,";
if ((data[idx] & 0x8) != 0) z += "ID116 VoltDerating,";
if ((data[idx] & 0x16) != 0) z += "ID117 VoltLoading,";
if ((data [idx] & 0x2048) != 0) z += "ID124 BatLowVoltageAlarm,";
if(z.length() > 0){
z.pop_back();
}
return {z};