-
Notifications
You must be signed in to change notification settings - Fork 156
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
Simplify attribute record types in foundation #457
Simplify attribute record types in foundation #457
Conversation
This is exactly the problem I was experiencing with Zen-01 thermostat and why deserialization was changed. |
I'd like to add an explicit unit test for that. Like this? In [1]: from zigpy.zcl import foundation as f
In [2]: f.ConfigureReportingResponse.deserialize(
... f.ConfigureReportingResponseRecord(
... status=f.Status.SUCCESS,
... direction=f.ReportingDirection.SendReports,
... attrid=0x0001,
... ).serialize() # b'\x00\x00\x01\x00'
... + f.ConfigureReportingResponseRecord(
... status=f.Status.SUCCESS,
... direction=f.ReportingDirection.SendReports,
... attrid=0x0002,
... ).serialize() # b'\x00\x00\x02\x00'
... + f.ConfigureReportingResponseRecord(
... status=f.Status.UNSUPPORTED_ATTRIBUTE,
... direction=f.ReportingDirection.SendReports,
... attrid=0x0003,
... ).serialize() # b'\x86\x00\x03\x00'
... )
Out[2]:
([ConfigureReportingResponseRecord(status=<Status.SUCCESS: 0>, direction=<ReportingDirection.SendReports: 0>, attrid=1),
ConfigureReportingResponseRecord(status=<Status.SUCCESS: 0>, direction=<ReportingDirection.SendReports: 0>, attrid=2),
ConfigureReportingResponseRecord(status=<Status.UNSUPPORTED_ATTRIBUTE: 134>, direction=<ReportingDirection.SendReports: 0>, attrid=3)],
b'') Or were they using multiple "short" SUCCESS responses (with only the |
I frankly don't remember all the details. i'll need to re-pair it and collect the logs. |
Shouldn't ReadAttributeResponse similar to ConfigureAttributeresponse ? from my knowledge and from what I have seen it is the case |
one contains the attribute value, the other one does not. Check ZCL specs for more details |
I've reverted the changes to |
The only one left is
AttributeReportingConfig
, which has a field whose data type is determined by a previous field. This isn't supported by thestruct
module right now without a few changes.One ambiguous class that I saw is
ConfigureReportingResponseRecord
. The spec (2.5.10.1) says that:It doesn't say "SHALL not", only "are not". Does this mean that status records for successfully configured attributes can possibly be present? If so, can they have
direction
andattrid
fields?I'd like for serialization and deserialization to be inverses, so
T.deserialize(T.serialize()) == (T, b"")
should always be true.This necessitated the behavior of the class and an associated unit test to be changed by making
ConfigureReportingResponseRecord(Status.SUCCESS, 0x00, 0xAABB).serialize()
be equal tob"\x00\x00\xbb\xaa"
instead ofb"\x00"
.