From 7ba2af26785eba2179003fedaed3488921072336 Mon Sep 17 00:00:00 2001 From: Manuel Pietschmann Date: Fri, 1 Feb 2019 17:10:21 +0100 Subject: [PATCH] Fix invalid creation of OSRAM/Centralite Motion Sensor-A ZHAPresence resource - Fix two ZHAPresence resources were created instead of one with unqiqueid ...-01-0500 - Delete invalid entry from database Issue https://github.com/dresden-elektronik/deconz-rest-plugin/issues/1053 --- database.cpp | 5 ++++- de_web_plugin.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/database.cpp b/database.cpp index f3d7470ba7..8fe7728b5c 100644 --- a/database.cpp +++ b/database.cpp @@ -124,6 +124,9 @@ void DeRestPluginPrivate::cleanUpDb() " WHERE modelid like 'RWL02%' " " AND type = 'ZHAPresence'", + // cleanup invalid sensor resource for Centralite motion sensor + "DELETE FROM sensors WHERE modelid = 'Motion Sensor-A' AND uniqueid LIKE '%02-0406'", + // delete duplicates in device_descriptors //"DELETE FROM device_descriptors WHERE rowid NOT IN" //" (SELECT max(rowid) FROM device_descriptors GROUP BY device_id,type,endpoint)", @@ -2714,7 +2717,7 @@ static int sqliteLoadAllSensorsCallback(void *user, int ncols, char **colval , c } else if (strcmp(colname[i], "deletedState") == 0) { - if (val == "deleted") + if (val == QLatin1String("deleted")) { sensor.setDeletedState(Sensor::StateDeleted); return 0; diff --git a/de_web_plugin.cpp b/de_web_plugin.cpp index cc87ca2b29..7e7151963c 100644 --- a/de_web_plugin.cpp +++ b/de_web_plugin.cpp @@ -3382,7 +3382,7 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const deCONZ:: { // only use IAS Zone cluster on endpoint 0x01 for Centralite motion sensors } - if (node->nodeDescriptor().manufacturerCode() == VENDOR_NYCE) + else if (node->nodeDescriptor().manufacturerCode() == VENDOR_NYCE) { // only use IAS Zone cluster on endpoint 0x01 for NYCE motion sensors }