added Voltage_div100

This commit is contained in:
Tester23
2023-09-23 21:34:03 +02:00
parent 2c327263b2
commit 735236a3f5
3 changed files with 26 additions and 1 deletions

View File

@ -556,6 +556,14 @@ int http_fn_index(http_request_t* request) {
hprintf255(request, "Voltage %.2fV (ch %s)", fValue, CHANNEL_GetLabel(i));
poststr(request, "</td></tr>");
}
else if (channelType == ChType_Voltage_div100) {
iValue = CHANNEL_Get(i);
fValue = iValue * 0.01f;
poststr(request, "<tr><td>");
hprintf255(request, "Voltage %.3fV (ch %s)", fValue, CHANNEL_GetLabel(i));
poststr(request, "</td></tr>");
}
else if (channelType == ChType_ReactivePower) {
iValue = CHANNEL_Get(i);
@ -1874,6 +1882,15 @@ void doHomeAssistantDiscovery(const char* topic, http_request_t* request) {
discoveryQueued = true;
}
break;
case ChType_Voltage_div100:
{
dev_info = hass_init_sensor_device_info(VOLTAGE_SENSOR, i, 3, 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_ReadOnlyLowMidHigh:
{
dev_info = hass_init_sensor_device_info(READONLYLOWMIDHIGH_SENSOR, i, -1, -1);