-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
Add timestamp to duplicate command detection #783
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Daniel Schall <[email protected]>
This pull request has been mentioned on openHAB Community. There might be relevant details there: |
I'm a bit surprised that this is set to minutes. The zigbee library handles duplicate transactions, but that is normally caused by APS retries so it's always in the millisecond range (it's the normal requirement in the APS layer). I assume this is a bug in the device itself if it's resending the same command after 5 minutes. I guess my other question is how reliable this is, how often it happens, and if the consequences of incorrectly dropping a frame here is worse that the consequences of the original duplicate issue? |
I guess we can lower it to 1 minute or probably even less. The times I've seen it it was happening right after each other, maybe a second or a few seconds apart. Now that I have a dedicated Zigbee controller only connected to one Tuya button, I can certainly monitor the communication for a while and check what's going on there. |
That's a little strange since the current system should filter these out. Can you post some logs of these duplicates please - I want to make sure that the existing mechanism is working ok.
Yes, that's the reason for the APS duplicate timer that is implemented in the library. That has a timeout of 5 seconds, which should cover most APS retries. I forget why 5 seconds was used - I can't remember if there's a requirement in the protocol for this or if it just seemed like a good number on the day :) You could try a search for
I think before merging this it would be good to quantify the problem so that it's understood a little better - then we can see if this is the right approach, or if we can modify/extend the existing mechanism. |
These are my log settings right now (omitting unrelated log settings):
Does that cover the data you'd like to see? |
Yes, that should be fine - the package is Thanks. |
Hey @cdjackson , I finally captured a duplicate command. |
PS: These Tuya thingys have other issues, mine eat through batteries like crazy. |
Sorry - I should have read your message better ;) |
So these commands are not considered duplicated since they are totally different transactions. |
Yeah, sorry, now that you're pointing it out.. On the positive side, it never happend during my testing (before the batteries were empty), so maybe we can live with this as a corner case when the buttons are pressed while the device is rejoining after being offline for a few days. |
This change keeps track of the timestamp of the last transaction sent by a Tuya wireless button.
Sometimes, these devices send duplicate commands, and we need to ignore these duplicates.
After some inactivity, the transaction ids restart at 1, so we also need to track the timestamp of the last transaction and ignore only those duplicates that happened in a short time (currently set to 5 minutes).