|
|
@ -17,15 +17,15 @@ union serial_u { |
|
|
|
|
|
|
|
|
|
|
|
// units
|
|
|
|
enum {UNIT_V = 0, UNIT_A, UNIT_W, UNIT_WH, UNIT_KWH, UNIT_HZ, UNIT_C, UNIT_PCT}; |
|
|
|
const char* const units[] = {"V", "A", "W", "Wh", "kWh", "Hz", "°C", "%"}; |
|
|
|
enum {UNIT_V = 0, UNIT_A, UNIT_W, UNIT_WH, UNIT_KWH, UNIT_HZ, UNIT_C, UNIT_PCT, UNIT_VA}; |
|
|
|
const char* const units[] = {"V", "A", "W", "Wh", "kWh", "Hz", "°C", "%","VA"}; |
|
|
|
|
|
|
|
|
|
|
|
// field types
|
|
|
|
enum {FLD_UDC = 0, FLD_IDC, FLD_PDC, FLD_YD, FLD_YW, FLD_YT, |
|
|
|
FLD_UAC, FLD_IAC, FLD_PAC, FLD_F, FLD_T, FLD_PCT, FLD_EFF, FLD_IRR}; |
|
|
|
FLD_UAC, FLD_IAC, FLD_PAC, FLD_F, FLD_T, FLD_PCT, FLD_EFF, FLD_IRR, FLD_PRA}; |
|
|
|
const char* const fields[] = {"U_DC", "I_DC", "P_DC", "YieldDay", "YieldWeek", "YieldTotal", |
|
|
|
"U_AC", "I_AC", "P_AC", "Freq", "Temp", "Pct", "Efficiency", "Irradiation"}; |
|
|
|
"U_AC", "I_AC", "P_AC", "Freq", "Temp", "Pct", "Efficiency", "Irradiation","P_ACr"}; |
|
|
|
|
|
|
|
// mqtt discovery device classes
|
|
|
|
enum {DEVICE_CLS_NONE = 0, DEVICE_CLS_CURRENT, DEVICE_CLS_ENERGY, DEVICE_CLS_PWR, DEVICE_CLS_VOLTAGE, DEVICE_CLS_FREQ, DEVICE_CLS_TEMP}; |
|
|
@ -95,6 +95,7 @@ const byteAssign_t hm1chAssignment[] = { |
|
|
|
{ FLD_UAC, UNIT_V, CH0, 14, 2, 10 }, |
|
|
|
{ FLD_IAC, UNIT_A, CH0, 22, 2, 100 }, |
|
|
|
{ FLD_PAC, UNIT_W, CH0, 18, 2, 10 }, |
|
|
|
{ FLD_PRA, UNIT_VA, CH0, 20, 2, 10 }, |
|
|
|
{ FLD_F, UNIT_HZ, CH0, 16, 2, 100 }, |
|
|
|
{ FLD_T, UNIT_C, CH0, 26, 2, 10 }, |
|
|
|
{ FLD_PDC, UNIT_W, CH0, CALC_PDC_CH0, 0, CMD_CALC }, |
|
|
@ -124,6 +125,7 @@ const byteAssign_t hm2chAssignment[] = { |
|
|
|
{ FLD_UAC, UNIT_V, CH0, 26, 2, 10 }, |
|
|
|
{ FLD_IAC, UNIT_A, CH0, 34, 2, 100 }, |
|
|
|
{ FLD_PAC, UNIT_W, CH0, 30, 2, 10 }, |
|
|
|
{ FLD_PRA, UNIT_VA, CH0, 32, 2, 10 }, |
|
|
|
{ FLD_F, UNIT_HZ, CH0, 28, 2, 100 }, |
|
|
|
{ FLD_T, UNIT_C, CH0, 38, 2, 10 }, |
|
|
|
{ FLD_YD, UNIT_WH, CH0, CALC_YD_CH0, 0, CMD_CALC }, |
|
|
@ -170,6 +172,7 @@ const byteAssign_t hm4chAssignment[] = { |
|
|
|
{ FLD_UAC, UNIT_V, CH0, 46, 2, 10 }, |
|
|
|
{ FLD_IAC, UNIT_A, CH0, 54, 2, 100 }, |
|
|
|
{ FLD_PAC, UNIT_W, CH0, 50, 2, 10 }, |
|
|
|
{ FLD_PRA, UNIT_VA, CH0, 52, 2, 10 }, |
|
|
|
{ FLD_F, UNIT_HZ, CH0, 48, 2, 100 }, |
|
|
|
{ FLD_PCT, UNIT_PCT, CH0, 56, 2, 10 }, |
|
|
|
{ FLD_T, UNIT_C, CH0, 58, 2, 10 }, |
|
|
|