-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
fix: Replace defaultSendRequestWhen
with pendingRequestTimeout
#6865
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems I can't add a suggested change without requesting changes 🤷 PR is fine for me without the suggestions too.
However with the requested change in place, we could call the same modernExtend for the other devices update and just pass 0
. Which seems cleaner and we want to eventually get most things in a modernExtend anyway.
Co-authored-by: Jorge Schrauwen <registration@blackdot.be>
Co-authored-by: Jorge Schrauwen <registration@blackdot.be>
Thanks, @sjorge, makes sense. I accepted your proposals, but for also changing it for the other two devices, I would have to dive a little bit deeper into the modernExtend thing first. Btw, I saw that you are the original author of that function. I am not 100% sure whether the 1h timeout will lead to your "ideal" device behavior (I.e. ideal tradeoff between robustness of request delivery and perceived responsiveness of the device), and I don't own any of these devices to test myself. |
I'm not supper impressed with the Aqara TVOC sensor for which I added the function. It's has most clusters not discoverable and genPollCtrl is just completely absent. Basically the device randomly sends a aqaraOpple report (non configurable), usually around 1x hour, don't think I've seen longer than that. So 1h is probably fine, although maybe 1h15 or something would be safer. But we do configure reporting for temperature and humidity clusters, and they report more often (unless the device resets, which it does often, then it forgets reporting and bindings 😡 ). So 1h seems fine for that device. It's probably not a good range for something like the sonoff contact sensors though, when not triggered they only report battery 1x every 36 hours. Perhaps we should not have a default for I'd need to dig up one of the sonoff contact sensors, I stopped using them because they were unreliable for me. If it doesn't support genPollCtrl we can add the quirk with 36h as timeout value. Just annoying a lot of (usually cheaper chinese) devices do not implement genPollCtrl. |
Well, I think it's probably not the best use of your time to dig out one of these devices just to optimize this value 😄 I have a bunch of the Aqara contact sensors in use and I believe they work similarly. But for several years now, I haven't yet felt the need to send any message to them after initial pairing. I think it does makes sense to remove the default so that every device has to define its own value, though. I will change it. And look into the modernExtend, sounds good :-) |
Thanks! Updated |
Sadly the behavior doesn't seem to be the same as before :( I could apply 3 reporting configs, get up, walk over and hit the button. Then they would apply. After this change, the first 1 fails before I can change the 3rd config via the frontend. I guess we can just remove the quirk then as it is now useless? Edit: does it try to send once immediately and then queue for retry? If so does it wait for some standard poll request that will probably never come as this aqara device doesn't really follow the standards well it seems. Before it would just queue and spam the device when it send any message. Edit2: joining is back to the hit and miss, need 4-5 attempts to get it through the initial configure as well. It does indeed look it at least tries to send each message once immediately but never tries again after. IMHO CSA is too lax with giving things the zigbee label, lumi/aqara/xiaomi/maji ignore so much of the standard. |
I don't fully understand the queue code but i don't think it should behave differently from the old send active except it tries ones imediatly... so not sure why the behavior with the aqara device is so different. |
Agree, it should not be different. Can you check the pendingRequestTimeout in the device database? Should be 1h, maybe it was reset somewhere Do you get the failure message after sending the second command? Or also if you just wait for a while? Can you check/post a debug log? Should contain lots of Request Queue output for that device. |
I'll look in the db later tonight, I just hit the apply button on the 3 reporting configs I wanted to tweak and got the timeout error for the 1st one just as I hit apply for the 3rd. |
There's one more thing you could try: Use the latest zhc with quirkPendingRequestTimeout together with zigbee-herdsman from last week. That way we would know if the queue or the quirk itself is the culprit. I'll see if I can reproduce with an aqara device tonight |
I wonder if it defaulted to the old 'immediate' behavior, I'm on dev so it has the correct herdsman and the zhc change. {
"id": 17,
"type": "EndDevice",
"ieeeAddr": "0x54ef441000684954",
"nwkAddr": 38890,
"manufId": 4447,
"manufName": "LUMI",
"powerSource": "Battery",
"modelId": "lumi.airmonitor.acn01",
"epList": [
1
],
"endpoints": {
"1": {
"profId": 260,
"epId": 1,
"devId": 1026,
"inClusterList": [
0,
3,
1280,
1,
1026,
1029,
12,
64704
],
"outClusterList": [
25
],
"clusters": {
"genBasic": {
"attributes": {
"modelId": "lumi.airmonitor.acn01",
"appVersion": 29
}
},
"msTemperatureMeasurement": {
"attributes": {
"measuredValue": 1871
}
},
"msRelativeHumidity": {
"attributes": {
"measuredValue": 4239
}
},
"genPowerCfg": {
"attributes": {
"batteryVoltage": 30
}
},
"aqaraOpple": {
"attributes": {
"247": {
"type": "Buffer",
"data": [
1,
33,
244,
11,
3,
40,
18,
4,
33,
168,
19,
5,
33,
21,
0,
6,
36,
15,
0,
0,
0,
0,
8,
33,
29,
1,
10,
33,
167,
86,
12,
32,
1,
100,
41,
82,
7,
101,
33,
171,
16,
102,
33,
66,
0,
103,
32,
1
]
},
"276": 1,
"297": 1,
"airQuality": 1,
"displayUnit": 1
}
},
"genAnalogInput": {
"attributes": {
"presentValue": 70
}
}
},
"binds": [
{
"cluster": 1026,
"type": "endpoint",
"deviceIeeeAddress": "0x00124b00228120b5",
"endpointID": 1
},
{
"cluster": 1029,
"type": "endpoint",
"deviceIeeeAddress": "0x00124b00228120b5",
"endpointID": 1
},
{
"cluster": 12,
"type": "endpoint",
"deviceIeeeAddress": "0x00124b00228120b5",
"endpointID": 1
},
{
"cluster": 1,
"type": "endpoint",
"deviceIeeeAddress": "0x00124b00228120b5",
"endpointID": 1
},
{
"cluster": 64704,
"type": "endpoint",
"deviceIeeeAddress": "0x00124b00228120b5",
"endpointID": 1
},
{
"cluster": 1026,
"type": "endpoint",
"deviceIeeeAddress": "0x001fee00000098be",
"endpointID": 1
},
{
"cluster": 1026,
"type": "endpoint",
"deviceIeeeAddress": "0x001fee00000097dd",
"endpointID": 1
}
],
"configuredReportings": [
{
"cluster": 1,
"attrId": 32,
"minRepIntval": 3600,
"maxRepIntval": 65000,
"repChange": 0,
"manufacturerCode": null
},
{
"cluster": 12,
"attrId": 85,
"minRepIntval": 10,
"maxRepIntval": 900,
"repChange": 5,
"manufacturerCode": null
},
{
"cluster": 1026,
"attrId": 0,
"minRepIntval": 10,
"maxRepIntval": 900,
"repChange": 50,
"manufacturerCode": null
},
{
"cluster": 1029,
"attrId": 0,
"minRepIntval": 10,
"maxRepIntval": 900,
"repChange": 100,
"manufacturerCode": null
}
],
"meta": {}
}
},
"appVersion": 29,
"stackVersion": 2,
"hwVersion": 1,
"dateCode": "20220222",
"swBuildId": "2020\u0000www.",
"zclVersion": 3,
"interviewCompleted": true,
"meta": {
"configured": 1324213189
},
"lastSeen": 1704977197205,
"defaultSendRequestWhen": "active"
} Look at the logs I cannot find a reconfigure being triggered, I think there might be a bug with modernExtend not triggering a reconfigure if functions get added/changed. @Koenkk 👈 I'll manually reconfigure when I am home and hope it completes, and check the db again. |
OK done some poking on my dev network (just test devices so lots less traffic). I have one of those Aqara TVOC's on there purely for dev work. Was still on zh 0.30.0: {
"id": 2,
"type": "EndDevice",
"ieeeAddr": "0x54ef441000684c5c",
"nwkAddr": 33988,
"manufId": 4447,
"manufName": "LUMI",
"powerSource": "Battery",
"modelId": "lumi.airmonitor.acn01",
"epList": [
1
],
"endpoints": {
"1": {
"profId": 260,
"epId": 1,
"devId": 1026,
"inClusterList": [
0,
3,
1280,
1
],
"outClusterList": [
25
],
"clusters": {
"genBasic": {
"attributes": {
"modelId": "lumi.airmonitor.acn01",
"appVersion": 29,
"manufacturerName": "LUMI",
"powerSource": 3,
"zclVersion": 3,
"stackVersion": 2,
"hwVersion": 1,
"dateCode": "20220222",
"swBuildId": "2020\u0000www."
}
},
"genPowerCfg": {
"attributes": {
"batteryVoltage": 30
}
},
"aqaraOpple": {
"attributes": {
"247": {
"type": "Buffer",
"data": [
1,
33,
184,
11,
3,
40,
21,
4,
33,
168,
1,
5,
33,
80,
0,
6,
36,
4,
0,
0,
0,
0,
8,
33,
29,
1,
10,
33,
0,
0,
12,
32,
1,
100,
41,
115,
8,
101,
33,
96,
16,
102,
33,
0,
0,
103,
32,
0
]
},
"airQuality": 0,
"displayUnit": 1
}
},
"msTemperatureMeasurement": {
"attributes": {
"measuredValue": 2145
}
},
"msRelativeHumidity": {
"attributes": {
"measuredValue": 4281
}
},
"genAnalogInput": {
"attributes": {
"presentValue": 0
}
}
},
"binds": [
{
"cluster": 1,
"type": "endpoint",
"deviceIeeeAddress": "0x00124b001e17ef39",
"endpointID": 1
},
{
"cluster": 12,
"type": "endpoint",
"deviceIeeeAddress": "0x00124b001e17ef39",
"endpointID": 1
},
{
"cluster": 1026,
"type": "endpoint",
"deviceIeeeAddress": "0x00124b001e17ef39",
"endpointID": 1
},
{
"cluster": 1029,
"type": "endpoint",
"deviceIeeeAddress": "0x00124b001e17ef39",
"endpointID": 1
}
],
"configuredReportings": [
{
"cluster": 1,
"attrId": 32,
"minRepIntval": 3600,
"maxRepIntval": 65000,
"repChange": 0,
"manufacturerCode": null
},
{
"cluster": 12,
"attrId": 85,
"minRepIntval": 10,
"maxRepIntval": 3600,
"repChange": 5,
"manufacturerCode": null
},
{
"cluster": 1026,
"attrId": 0,
"minRepIntval": 10,
"maxRepIntval": 3600,
"repChange": 100,
"manufacturerCode": null
},
{
"cluster": 1029,
"attrId": 0,
"minRepIntval": 10,
"maxRepIntval": 3600,
"repChange": 100,
"manufacturerCode": null
}
],
"meta": {}
}
},
"appVersion": 29,
"stackVersion": 2,
"hwVersion": 1,
"dateCode": "20220222",
"swBuildId": "2020\u0000www.",
"zclVersion": 3,
"interviewCompleted": true,
"meta": {
"configured": 1324213189
},
"lastSeen": 1704984050254,
"defaultSendRequestWhen": "immediate"
} After upgrading to 0.32.2: (no re-configure triggered)
{
"id": 2,
"type": "EndDevice",
"ieeeAddr": "0x54ef441000684c5c",
"nwkAddr": 33988,
"manufId": 4447,
"manufName": "LUMI",
"powerSource": "Battery",
"modelId": "lumi.airmonitor.acn01",
"epList": [
1
],
"endpoints": {
"1": {
"profId": 260,
"epId": 1,
"devId": 1026,
"inClusterList": [
0,
3,
1280,
1,
1026,
1029,
12,
64704
],
"outClusterList": [
25
],
"clusters": {
"genBasic": {
"attributes": {
"modelId": "lumi.airmonitor.acn01",
"appVersion": 29,
"manufacturerName": "LUMI",
"powerSource": 3,
"zclVersion": 3,
"stackVersion": 2,
"hwVersion": 1,
"dateCode": "20220222",
"swBuildId": "2020\u0000www."
}
},
"genPowerCfg": {
"attributes": {
"batteryVoltage": 28
}
},
"aqaraOpple": {
"attributes": {
"247": {
"type": "Buffer",
"data": [
1,
33,
248,
10,
3,
40,
21,
4,
33,
168,
19,
5,
33,
80,
0,
6,
36,
3,
0,
0,
0,
0,
8,
33,
29,
1,
10,
33,
0,
0,
12,
32,
1,
100,
41,
106,
8,
101,
33,
27,
14,
102,
33,
57,
0,
103,
32,
1
]
},
"airQuality": 1,
"displayUnit": 1
}
},
"msTemperatureMeasurement": {
"attributes": {
"measuredValue": 2154
}
},
"msRelativeHumidity": {
"attributes": {
"measuredValue": 3610
}
},
"genAnalogInput": {
"attributes": {
"presentValue": 57
}
}
},
"binds": [
{
"cluster": 1,
"type": "endpoint",
"deviceIeeeAddress": "0x00124b001e17ef39",
"endpointID": 1
},
{
"cluster": 12,
"type": "endpoint",
"deviceIeeeAddress": "0x00124b001e17ef39",
"endpointID": 1
},
{
"cluster": 1026,
"type": "endpoint",
"deviceIeeeAddress": "0x00124b001e17ef39",
"endpointID": 1
},
{
"cluster": 1029,
"type": "endpoint",
"deviceIeeeAddress": "0x00124b001e17ef39",
"endpointID": 1
}
],
"configuredReportings": [
{
"cluster": 1,
"attrId": 32,
"minRepIntval": 3600,
"maxRepIntval": 65000,
"repChange": 0,
"manufacturerCode": null
},
{
"cluster": 12,
"attrId": 85,
"minRepIntval": 10,
"maxRepIntval": 3600,
"repChange": 5,
"manufacturerCode": null
},
{
"cluster": 1026,
"attrId": 0,
"minRepIntval": 10,
"maxRepIntval": 3600,
"repChange": 100,
"manufacturerCode": null
},
{
"cluster": 1029,
"attrId": 0,
"minRepIntval": 10,
"maxRepIntval": 3600,
"repChange": 100,
"manufacturerCode": null
}
],
"meta": {}
}
},
"appVersion": 29,
"stackVersion": 2,
"hwVersion": 1,
"dateCode": "20220222",
"swBuildId": "2020\u0000www.",
"zclVersion": 3,
"interviewCompleted": true,
"meta": {
"configured": 1324213189
},
"lastSeen": 1704984421724
} It successfully executed the quirk extends as it added the missing clusters, but |
Added some logging to it and the quirk does get called:
So it seems that either I believe it is the save function, as it calls
|
Thanks for checking!
Yes, I just noticed that too and that could explain it. It is simply not persisted, only For testing, you can just try to also set checkinInterval from the quirk (need to make it public/add a setter first). As a proper fix, I think I'd rename the quirk to quirkCheckinInterval(), and add a setter for it to zh which also sets pendingRequesttimeout |
/~https://github.com/Koenkk/zigbee-herdsman/compare/master...sjorge:device_save_pendingRequestTimeout?expand=1 also seems to work I think, but your proposal is probably better. I'm out of time to mess around today, I might have another go at it this weekend unless you beat me too it. If you do a follow PR on zhc when renaming the quirk, also grab the change from /~https://github.com/Koenkk/zigbee-herdsman-converters/pull/6874/files if it's not merged yet. That fixes the other 2 devices to also use the quirk. |
sounds good! Thanks for checking! |
defaultSendRequestWhen
is removed with Koenkk/zigbee-herdsman#860.This PR replaces it with
pendingRequestTimeout