diff --git a/src/driver/drv_tuyaMCU.c b/src/driver/drv_tuyaMCU.c index d47640037..bb2b0428d 100644 --- a/src/driver/drv_tuyaMCU.c +++ b/src/driver/drv_tuyaMCU.c @@ -898,7 +898,7 @@ void TuyaMCU_ParseStateMessage(const byte *data, int len) { //CHANNEL_SetAllChannelsByType(QQQQQQ, iVal); // 06 46 = 1606 => A x 100? ? iVal = data[ofs + 11 + 4] << 8 | data[ofs + 12 + 4]; - //CHANNEL_SetAllChannelsByType(QQQQQQ, iVal); + CHANNEL_SetAllChannelsByType(ChType_Current_div1000, iVal); // Voltage? iVal = data[ofs + 13 + 4] << 8 | data[ofs + 14 + 4]; CHANNEL_SetAllChannelsByType(ChType_Voltage_div10, iVal); diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c index 5991cb6fc..69995546f 100644 --- a/src/httpserver/http_fns.c +++ b/src/httpserver/http_fns.c @@ -518,6 +518,14 @@ int http_fn_index(http_request_t* request) { hprintf255(request, "Current %fA (ch %i)", fValue, i); poststr(request, ""); } + else if (channelType == ChType_Current_div1000) { + iValue = CHANNEL_Get(i); + fValue = iValue * 0.001f; + + poststr(request, ""); + hprintf255(request, "Current %fA (ch %i)", fValue, i); + poststr(request, ""); + } else if (h_isChannelRelay(i) || channelType == ChType_Toggle) { const char* c; if (i <= 1) { diff --git a/src/new_pins.c b/src/new_pins.c index 46d346688..396cd3bc0 100644 --- a/src/new_pins.c +++ b/src/new_pins.c @@ -1187,6 +1187,8 @@ int CHANNEL_ParseChannelType(const char *s) { return ChType_EnergyExport_kWh_div1000; if (!stricmp(s, "EnergyToday_kWh_div1000")) return ChType_EnergyToday_kWh_div1000; + if (!stricmp(s, "Current_div1000")) + return ChType_Current_div1000; return ChType_Error; } static int CMD_setButtonHoldRepeat(const void *context, const char *cmd, const char *args, int cmdFlags){ diff --git a/src/new_pins.h b/src/new_pins.h index e2a578a94..0b0cace9f 100644 --- a/src/new_pins.h +++ b/src/new_pins.h @@ -98,6 +98,7 @@ enum ChannelType { ChType_EnergyTotal_kWh_div1000, ChType_EnergyExport_kWh_div1000, ChType_EnergyToday_kWh_div1000, + ChType_Current_div1000, };