[BT] Fixes for DT24 Triggering restart during discovery (#1614)
This commit is contained in:
1 parent
8d5c2c4d58
commit
5927259db6
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -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
|
||||
};
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user