Prevent loading of multpiple ubisys ZHASwitch endpoints from database
Issue
@@ -2172,6 +2172,18 @@ static int sqliteLoadAllSensorsCallback(void *user, int ncols, char **colval , c
}
}
+ // check for older setups with multiple ZHASwitch sensors per device
+ if (sensor.manufacturer() == QLatin1String("ubisys") && sensor.type() == QLatin1String("ZHASwitch"))
+ {
+ if ((sensor.modelId().startsWith(QLatin1String("D1")) && sensor.fingerPrint().endpoint != 0x02) ||
+ (sensor.modelId().startsWith(QLatin1String("S2")) && sensor.fingerPrint().endpoint != 0x03) ||
+ (sensor.modelId().startsWith(QLatin1String("C4")) && sensor.fingerPrint().endpoint != 0x01))
+ {
+ DBG_Printf(DBG_INFO, "ubisys sensor id: %s, endpoint 0x%02X (%s) ignored loading from database\n", qPrintable(sensor.id()), sensor.fingerPrint().endpoint, qPrintable(sensor.modelId()));
+ return 0;
+ }
+ }
+
if (sensor.fingerPrint().hasInCluster(IAS_ZONE_CLUSTER_ID))
{
item = sensor.addItem(DataTypeBool, RStateLowBattery);
