diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c
index 45db2d3bb..f304408be 100644
--- a/src/httpserver/http_fns.c
+++ b/src/httpserver/http_fns.c
@@ -552,6 +552,14 @@ int http_fn_index(http_request_t* request) {
hprintf255(request, "Frequency %.2fHz (ch %s)", fValue, CHANNEL_GetLabel(i));
poststr(request, "");
}
+ else if (channelType == ChType_Frequency_div10) {
+ iValue = CHANNEL_Get(i);
+ fValue = iValue * 0.1f;
+
+ poststr(request, "
| ");
+ hprintf255(request, "Frequency %.2fHz (ch %s)", fValue, CHANNEL_GetLabel(i));
+ poststr(request, " |
");
+ }
else if (channelType == ChType_EnergyToday_kWh_div1000) {
iValue = CHANNEL_Get(i);
fValue = iValue * 0.001f;
@@ -2071,6 +2079,15 @@ void doHomeAssistantDiscovery(const char* topic, http_request_t* request) {
discoveryQueued = true;
}
break;
+ case ChType_Frequency_div10:
+ {
+ dev_info = hass_init_sensor_device_info(FREQUENCY_SENSOR, i, 3, 1, 1);
+ MQTT_QueuePublish(topic, dev_info->channel, hass_build_discovery_json(dev_info), OBK_PUBLISH_FLAG_RETAIN);
+ hass_free_device_info(dev_info);
+
+ discoveryQueued = true;
+ }
+ break;
case ChType_EnergyTotal_kWh_div100:
{
dev_info = hass_init_sensor_device_info(ENERGY_SENSOR, i, 3, 2, 1);
diff --git a/src/new_pins.c b/src/new_pins.c
index cbe7db2ef..fc73eec23 100644
--- a/src/new_pins.c
+++ b/src/new_pins.c
@@ -1049,6 +1049,7 @@ float CHANNEL_GetFinalValue(int channel) {
case ChType_Temperature_div10:
case ChType_Voltage_div10:
case ChType_Power_div10:
+ case ChType_Frequency_div10:
dVal = (float)iVal / 10;
break;
case ChType_Frequency_div100:
diff --git a/src/new_pins.h b/src/new_pins.h
index 1e0b41501..9afaba229 100644
--- a/src/new_pins.h
+++ b/src/new_pins.h
@@ -873,6 +873,13 @@ typedef enum channelType_e {
//chandetail:"file":"new_pins.h",
//chandetail:"driver":""}
ChType_TimerSeconds,
+ //chandetail:{"name":"Frequency_div10",
+ //chandetail:"title":"TODO",
+ //chandetail:"descr":"For TuyaMCU power metering. Not used for BL09** and CSE** sensors. Divider is used by TuyaMCU, because TuyaMCU sends always values as integers so we have to divide them before displaying on UI",
+ //chandetail:"enum":"ChType_Frequency_div10",
+ //chandetail:"file":"new_pins.h",
+ //chandetail:"driver":""}
+ ChType_Frequency_div10,
//chandetail:{"name":"Max",
//chandetail:"title":"TODO",
//chandetail:"descr":"This is the current total number of available channel types.",