Removed None

This commit is contained in:
Indu Prakash
2022-10-24 19:52:59 -05:00
parent 8b7ba20544
commit a7f840c05d
2 changed files with 3 additions and 4 deletions

View File

@ -255,9 +255,8 @@ HassDeviceInfo* hass_init_sensor_device_info(int index) {
if ((index >= OBK_CONSUMPTION_TOTAL) && (index <= OBK_CONSUMPTION_STATS))
{
const char* device_class_value = counter_devClasses[index - OBK_CONSUMPTION_TOTAL];
cJSON_AddStringToObject(info->root, "dev_cla", device_class_value); //device_class=consumption
if (strcmp(device_class_value, "None")) {
if (strlen(device_class_value) > 0) {
cJSON_AddStringToObject(info->root, "dev_cla", device_class_value); //device_class=energy
cJSON_AddStringToObject(info->root, "unit_of_meas", "Wh"); //unit_of_measurement
}