Skip to content

Button events check for duplicated sequence number (IKEA, Tuya and LIDL) #4716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions de_web_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4149,15 +4149,32 @@ void DeRestPluginPrivate::checkSensorButtonEvent(Sensor *sensor, const deCONZ::A
}
else if (sensor->modelId() == QLatin1String("HG06323")) // LIDL Remote Control
{
// Probably needed because deCONZ doesn't send Default Response to unicast command.
if (zclFrame.sequenceNumber() == sensor->previousSequenceNumber)
checkReporting = true;
}

if (zclFrame.sequenceNumber() == sensor->previousSequenceNumber)
{
// useful in general but limit scope to known problematic devices
if (isTuyaManufacturerName(sensor->manufacturer()) ||
// TODO "HG06323" can likely be removed after testing,
// since the device only sends group casts and we don't expect this to trigger.
sensor->modelId() == QLatin1String("HG06323"))
{
// deCONZ doesn't always send ZCL Default Response to unicast commands, or they can get lost.
// in this case some devices re-send the command multiple times
DBG_Printf(DBG_INFO, "Discard duplicated zcl.cmd: 0x%02X, cluster: 0x%04X with zcl.seq: %u for %s / %s\n",
zclFrame.commandId(), ind.clusterId(), zclFrame.sequenceNumber(), qPrintable(sensor->manufacturer()), qPrintable(sensor->modelId()));
return;
}
sensor->previousSequenceNumber = zclFrame.sequenceNumber();
checkReporting = true;
else // warn only
{
DBG_Printf(DBG_INFO, "Warning duplicated zcl.cmd: 0x%02X, cluster: 0x%04X with zcl.seq: %u for %s / %s\n",
zclFrame.commandId(), ind.clusterId(), zclFrame.sequenceNumber(), qPrintable(sensor->manufacturer()), qPrintable(sensor->modelId()));
}
}

sensor->previousSequenceNumber = zclFrame.sequenceNumber();

if (ind.dstAddressMode() == deCONZ::ApsGroupAddress && ind.dstAddress().group() != 0)
{
QStringList gids;
Expand Down
2 changes: 1 addition & 1 deletion sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class Sensor : public Resource,
uint8_t previousDirection;
quint16 previousCt;
QDateTime durationDue;
uint8_t previousSequenceNumber;
uint16_t previousSequenceNumber = 0xffff;
uint8_t previousCommandId;


Expand Down