Skip to content

Commit

Permalink
Fix invalid creation of OSRAM/Centralite Motion Sensor-A ZHAPresence …
Browse files Browse the repository at this point in the history
…resource

- Fix two ZHAPresence resources were created instead of one with unqiqueid ...-01-0500
- Delete invalid entry from database

Issue #1053
  • Loading branch information
manup committed Feb 1, 2019
1 parent 2e2a389 commit 7ba2af2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 7ba2af2

Please sign in to comment.