diff --git a/main/ZgatewayBT.ino b/main/ZgatewayBT.ino index c7dcb5b..697a932 100644 --- a/main/ZgatewayBT.ino +++ b/main/ZgatewayBT.ino @@ -537,7 +537,7 @@ void DT24Discovery(const char* mac, const char* sensorModel_id) { {"sensor", "watt-hour", mac, "power", jsonEnergy, "", "", "kWh", stateClassMeasurement}, {"sensor", "price", mac, "", jsonMsg, "", "", "", stateClassNone}, {"sensor", "temp", mac, "temperature", jsonTempc, "", "", "°C", stateClassMeasurement}, - {"binary_sensor", "inUse", mac, "power", jsonInuse, "", "", ""} + {"binary_sensor", "inUse", mac, "power", jsonInuse, "", "", "", stateClassNone} //component type,name,availability topic,device class,value template,payload on, payload off, unit of measurement }; diff --git a/main/ZmqttDiscovery.ino b/main/ZmqttDiscovery.ino index 517519b..582425d 100644 --- a/main/ZmqttDiscovery.ino +++ b/main/ZmqttDiscovery.ino @@ -303,7 +303,7 @@ void createDiscovery(const char* sensor_type, sensor["pl_avail"] = payload_available; // payload_on if (payload_not_available[0]) sensor["pl_not_avail"] = payload_not_available; //payload_off - if (state_class[0]) + if (state_class && state_class[0]) sensor["state_class"] = state_class; //add the state class on the sensors ( https://developers.home-assistant.io/docs/core/entity/sensor/#available-state-classes ) if (state_on != nullptr) if (strcmp(state_on, "true") == 0) {