Skip to content

Commit

Permalink
Prepare for deconz-lib deCONZ::Attribute::lastRead() change (dresden-…
Browse files Browse the repository at this point in the history
…elektronik#7158)

Returned data type will be `int64_t` instead of `time_t`.
  • Loading branch information
manup authored Aug 7, 2023
1 parent 0fba4d6 commit 6fd2186
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6032,7 +6032,7 @@ void DeRestPluginPrivate::addSensorNode(const deCONZ::Node *node, const deCONZ::
{
for (const deCONZ::ZclAttribute &attr : ci->attributes())
{
if (attr.id() == 0x0001 && attr.lastRead() != static_cast<time_t>(-1)) // IAS Zone type
if (attr.id() == 0x0001 && attr.lastRead() <= 0) // IAS Zone type
{
// Might not work as intended, when IAS Zone Type hasn't been read.
switch (attr.numericValue().u16) {
Expand Down Expand Up @@ -14299,7 +14299,7 @@ void DeRestPluginPrivate::delayedFastEnddeviceProbe(const deCONZ::NodeEvent *eve
unavailBasicAttr.push_back(attr.id());
continue;
}
else if (attr.lastRead() != static_cast<time_t>(-1) && attr.dataType() == deCONZ::ZclCharacterString && attr.toString().isEmpty())
else if (attr.lastRead() <= 0 && attr.dataType() == deCONZ::ZclCharacterString && attr.toString().isEmpty())
{
// e.g. some devices return empty strings.
// Check read timestamp to make sure the attribute is read at least once.
Expand Down
2 changes: 1 addition & 1 deletion poll_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ void PollManager::pollTimerFired()
// discard attributes which are not be available
if (attrId == attr.id() && attr.isAvailable())
{
if (attr.dataType_t() == deCONZ::ZclCharacterString && attr.toString().isEmpty() && attr.lastRead() != static_cast<time_t>(-1))
if (attr.dataType_t() == deCONZ::ZclCharacterString && attr.toString().isEmpty() && attr.lastRead() <= 0)
{
continue; // skip empty string attributes which are available, read only once
}
Expand Down

0 comments on commit 6fd2186

Please sign in to comment.