@ -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 , UNIT_VA , UNIT_ALARM_MES_ID } ;
enum { UNIT_V = 0 , UNIT_A , UNIT_W , UNIT_WH , UNIT_KWH , UNIT_HZ , UNIT_C , UNIT_PCT , UNIT_VA , UNIT_NONE } ;
const char * const units [ ] = { " V " , " A " , " W " , " Wh " , " kWh " , " Hz " , " °C " , " % " , " VAr " , " " } ;
// 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_PRA , FLD_ALARM_MES_ID } ;
FLD_UAC , FLD_IAC , FLD_PAC , FLD_F , FLD_T , FLD_PCT , FLD_EFF , FLD_IRR , FLD_PRA , FLD_ALARM_MES_ID , FLD_FW_VERSION , FLD_FW_BUILD_YEAR , FLD_FW_BUILD_MONTH_DAY , FLD_HW_ID } ;
const char * const fields [ ] = { " U_DC " , " I_DC " , " P_DC " , " YieldDay " , " YieldWeek " , " YieldTotal " ,
" U_AC " , " I_AC " , " P_AC " , " Freq " , " Temp " , " Pct " , " Efficiency " , " Irradiation " , " P_ACr " , " ALARM_MES_ID " } ;
" U_AC " , " I_AC " , " P_AC " , " Freq " , " Temp " , " Pct " , " Efficiency " , " Irradiation " , " P_ACr " , " ALARM_MES_ID " , " FWVersion " , " FWBuildYear " , " FWBuildMonthDay " , " HWPartId " } ;
// 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 } ;
@ -81,6 +81,19 @@ typedef struct {
* ( complete payload in buffer )
* */
//-------------------------------------
// HM-Series
//-------------------------------------
const byteAssign_t InfoAssignment [ ] = {
{ FLD_FW_VERSION , UNIT_NONE , CH0 , 0 , 2 , 1 } ,
{ FLD_FW_BUILD_YEAR , UNIT_NONE , CH0 , 2 , 2 , 1 } ,
{ FLD_FW_BUILD_MONTH_DAY , UNIT_NONE , CH0 , 4 , 2 , 1 } ,
{ FLD_HW_ID , UNIT_NONE , CH0 , 8 , 2 , 1 }
} ;
# define HMINFO_LIST_LEN (sizeof(InfoAssignment) / sizeof(byteAssign_t))
//-------------------------------------
// HM300, HM350, HM400
//-------------------------------------
@ -98,7 +111,7 @@ const byteAssign_t hm1chAssignment[] = {
{ 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_ALARM_MES_ID , UNIT_ALARM_MES_ID , CH0 , 28 , 2 , 1 } ,
{ FLD_ALARM_MES_ID , UNIT_NONE , CH0 , 28 , 2 , 1 } ,
{ FLD_PDC , UNIT_W , CH0 , CALC_PDC_CH0 , 0 , CMD_CALC } ,
{ FLD_EFF , UNIT_PCT , CH0 , CALC_EFF_CH0 , 0 , CMD_CALC }
} ;
@ -129,7 +142,7 @@ const byteAssign_t hm2chAssignment[] = {
{ 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_ALARM_MES_ID , UNIT_ALARM_MES_ID , CH0 , 40 , 2 , 1 } ,
{ FLD_ALARM_MES_ID , UNIT_NONE , CH0 , 40 , 2 , 1 } ,
{ FLD_YD , UNIT_WH , CH0 , CALC_YD_CH0 , 0 , CMD_CALC } ,
{ FLD_YT , UNIT_KWH , CH0 , CALC_YT_CH0 , 0 , CMD_CALC } ,
{ FLD_PDC , UNIT_W , CH0 , CALC_PDC_CH0 , 0 , CMD_CALC } ,
@ -178,7 +191,7 @@ const byteAssign_t hm4chAssignment[] = {
{ FLD_F , UNIT_HZ , CH0 , 48 , 2 , 100 } ,
{ FLD_PCT , UNIT_PCT , CH0 , 56 , 2 , 10 } ,
{ FLD_T , UNIT_C , CH0 , 58 , 2 , 10 } ,
{ FLD_ALARM_MES_ID , UNIT_ALARM_MES_ID , CH0 , 60 , 2 , 1 } ,
{ FLD_ALARM_MES_ID , UNIT_NONE , CH0 , 60 , 2 , 1 } ,
{ FLD_YD , UNIT_WH , CH0 , CALC_YD_CH0 , 0 , CMD_CALC } ,
{ FLD_YT , UNIT_KWH , CH0 , CALC_YT_CH0 , 0 , CMD_CALC } ,
{ FLD_PDC , UNIT_W , CH0 , CALC_PDC_CH0 , 0 , CMD_CALC } ,