Fix refreshing SwBuildId last set time stamps
The problem was that periodic polling of the attribute was triggered endlessly because the last query time stamp was never updated.
lightNode->setSwBuildId(str) was removed because item->setValue(str) does the same and faster since item is already known.
@@ -3103,34 +3103,38 @@ LightNode *DeRestPluginPrivate::updateLightNode(const deCONZ::NodeEvent &event)
}
else if (ia->id() == 0x0006) // Date code
{
- QString str = ia->toString();
+ const QString str = ia->toString().trimmed();
ResourceItem *item = lightNode->item(RAttrSwVersion);
- if (item && !str.isEmpty() && str != item->toString())
+ if (item && !str.isEmpty())
+ {
+ if (str != item->toString())
{
- item->setValue(str);
- lightNode->setSwBuildId(str);
lightNode->setNeedSaveDatabase(true);
queSaveDb(DB_LIGHTS, DB_LONG_SAVE_DELAY);
updated = true;
}
+ item->setValue(str); // always needed to refresh set timestamp
+ }
}
else if (ia->id() == 0x4000) // Software build identifier
{
- QString str = ia->toString();
+ const QString str = ia->toString().trimmed();
ResourceItem *item = lightNode->item(RAttrSwVersion);
deCONZ::NumericUnion dummy;
lightNode->setZclValue(updateType, event.endpoint(), event.clusterId(), ia->id(), dummy);
- if (item && !str.isEmpty() && str != item->toString())
+ if (item && !str.isEmpty())
+ {
+ if (str != item->toString())
{
- item->setValue(str);
- lightNode->setSwBuildId(str);
lightNode->setNeedSaveDatabase(true);
queSaveDb(DB_LIGHTS, DB_LONG_SAVE_DELAY);
updated = true;
}
+ item->setValue(str); // always needed to refresh set timestamp
+ }
}
else if (ia->id() == 0x4005 && lightNode->manufacturerCode() == VENDOR_MUELLER)
{
