Skip to content
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

min report interval 0 subscription doesn't flush final CurrentLevel after On/Off command #16653

Closed
mspang opened this issue Mar 25, 2022 · 2 comments · Fixed by #17426
Closed
Assignees

Comments

@mspang
Copy link
Contributor

mspang commented Mar 25, 2022

Problem

Setting the minimal report interval to zero so that updates arrive in the minimal possible time can cause dirty attributes to not be flushed out (as in the case of the level control cluster and the On and Off commands)

In [1]: node = 0x3e8

In [2]: sub = await devCtrl.ReadAttribute(node, [Clusters.OnOff.Attributes.OnOff, Clusters.LevelControl.Attributes.CurrentLevel], reportInterval=(0, 120))
2022-03-24 22:26:55 yuif chip.SC[372750] ERROR The device does not support GetClock_RealTimeMS() API. This will eventually result in CASE session setup failures.

In [3]: await devCtrl.SendCommand(node, 1, Clusters.OnOff.Commands.On())

Attribute Changed:
{
│   'Endpoint': 1,
│   'Attribute': <class 'chip.clusters.Objects.LevelControl.Attributes.CurrentLevel'>,
│   'Value': 1
}
Attribute Changed:
{
│   'Endpoint': 1,
│   'Attribute': <class 'chip.clusters.Objects.OnOff.Attributes.OnOff'>,
│   'Value': True
}

Issuing a read seems to force the subscription to flush:

In [4]: _ = await devCtrl.ReadAttribute(node, [Clusters.OnOff.Attributes.OnOff, Clusters.LevelControl.Attributes.CurrentLevel])
Attribute Changed:
{
│   'Endpoint': 1,
│   'Attribute': <class 'chip.clusters.Objects.LevelControl.Attributes.CurrentLevel'>,
│   'Value': 254
}

@mrjerryjohns @erjiaqing

@mspang mspang changed the title min report interval 0 subscription loses CurrentLevel reports min report interval 0 subscription doesn't flush final CurrentLevel after On/Off command Mar 25, 2022
@mrjerryjohns
Copy link
Contributor

Yeah, seems something is wonky in the dirty management and report generation logic...

@mrjerryjohns mrjerryjohns self-assigned this Mar 25, 2022
@mrjerryjohns
Copy link
Contributor

mrjerryjohns commented Mar 25, 2022

We weren't running the reporting engine upon receiving a status response to the last report in the exchange. This would happen automatically with a min interval != 0, since that schedules a timer after the report gets sent (assuming the timer fires after we receive a status response, which it should in most cases...) but not in this case, since min interval = 0.

Will put out a fix tomorrow with tests...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants