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

[iCloud] Fix existing things stopped working and re-appeared as new in the inbox #14661

Merged
merged 7 commits into from
May 3, 2023

Conversation

maihacke
Copy link
Contributor

@maihacke maihacke commented Mar 24, 2023

Change handling for device IDs in icloud binding

Lately users discover problems with changes in the device ID in the iCloud API.
See discussion here https://community.openhab.org/t/icloud-binding-communication-error/122131/597

I saved the device data json before and after this change happened.
Each device has three IDs in the json:

id, baUUID, deviceDiscoveryId

Currently we use id to identify devices. This id has changed lately (back and forth and now again, see discussion). That's why openhab identfies these devices as new and put them into the inbox. The other IDs did not change - at least between my two files. So we have some chances that changing the binding to use one of the other IDs this problem could be solved.

This PR changes the binding to use deviceDiscoveryId instead of id. As fallback it uses the device name, since old devices do not have a deviceDiscoveryId.

Should fix #14660

@maihacke maihacke requested a review from a team as a code owner March 24, 2023 07:58
@wborn wborn changed the title Use deviceDiscoveryId instead of id [icloud] Use deviceDiscoveryId instead of id Mar 24, 2023
@maihacke maihacke changed the title [icloud] Use deviceDiscoveryId instead of id [iCloud] Use deviceDiscoveryId instead of id Mar 24, 2023
@maihacke maihacke changed the title [iCloud] Use deviceDiscoveryId instead of id WIP: [iCloud] Use deviceDiscoveryId instead of id Mar 24, 2023
@maihacke maihacke changed the title WIP: [iCloud] Use deviceDiscoveryId instead of id [iCloud] Use deviceDiscoveryId instead of id Mar 27, 2023
@maihacke maihacke force-pushed the 14660-icloud-change-id branch 3 times, most recently from 690f6a7 to 4672bb0 Compare March 30, 2023 07:37
Signed-off-by: Simon Spielmann <simon.spielmann@gmx.de>
Signed-off-by: Simon Spielmann <simon.spielmann@gmx.de>
Signed-off-by: Simon Spielmann <simon.spielmann@gmx.de>
Signed-off-by: Simon Spielmann <simon.spielmann@gmx.de>
Signed-off-by: Simon Spielmann <simon.spielmann@gmx.de>
@maihacke maihacke force-pushed the 14660-icloud-change-id branch from addf956 to fbf7172 Compare March 30, 2023 08:19
Signed-off-by: Simon Spielmann <simon.spielmann@gmx.de>
@maihacke
Copy link
Contributor Author

@jlaur Without this change the icloud binding stops working after a few days. Maybe we could consider it for 4.0.0.

@jlaur jlaur added the bug An unexpected problem or unintended behavior of an add-on label Apr 27, 2023
Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, only two minor suggestions added.

Do you think "Fix things reappearing in inbox" would be an accurate title for the PR (to go into the release notes)?

Signed-off-by: Simon Spielmann <simon.spielmann@gmx.de>
@maihacke
Copy link
Contributor Author

Thanks for the review.

@maihacke maihacke requested a review from jlaur May 3, 2023 09:16
@jlaur jlaur changed the title [iCloud] Use deviceDiscoveryId instead of id [iCloud] Fix things reappearing in inbox May 3, 2023
Copy link
Contributor

@jlaur jlaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jlaur jlaur merged commit 67f1a80 into openhab:main May 3, 2023
@jlaur jlaur added this to the 4.0 milestone May 3, 2023
@jlaur
Copy link
Contributor

jlaur commented May 3, 2023

@maihacke - for my understanding, why did the binding stop working after a few days? It seems that the "Fix things reappearing in inbox" does not fully cover the actual fix.

@maihacke
Copy link
Contributor Author

maihacke commented May 3, 2023

@maihacke - for my understanding, why did the binding stop working after a few days? It seems that the "Fix things reappearing in inbox" does not fully cover the actual fix.

The reason is that the IDs which where used in the binding before that fix where no longer constant. So they changed from time to time in the API results. This lead to
A: New things appeared in the in inbox for the new IDs.
B: Existing things stopped working because their IDs where no longer valid in the iCloud API.

Maybe we could use

"Existing things stopped working and re-appeared as new in the inbox".

@jlaur jlaur changed the title [iCloud] Fix things reappearing in inbox [iCloud] Fix existing things stopped working and re-appeared as new in the inbox May 3, 2023
@jlaur
Copy link
Contributor

jlaur commented May 3, 2023

@maihacke - thanks.

tb4jc pushed a commit to tb4jc/openhab-addons that referenced this pull request Jun 19, 2023
* Use deviceDiscoveryId instead of id
* Use device display name if discovery id is empty

Signed-off-by: Simon Spielmann <simon.spielmann@gmx.de>
Signed-off-by: Thomas Burri <thomas.burri@alstomgroup.com>
matchews pushed a commit to matchews/openhab-addons that referenced this pull request Aug 9, 2023
* Use deviceDiscoveryId instead of id
* Use device display name if discovery id is empty

Signed-off-by: Simon Spielmann <simon.spielmann@gmx.de>
Signed-off-by: Matt Myers <mmyers75@icloud.com>
austvik pushed a commit to austvik/openhab-addons that referenced this pull request Mar 27, 2024
* Use deviceDiscoveryId instead of id
* Use device display name if discovery id is empty

Signed-off-by: Simon Spielmann <simon.spielmann@gmx.de>
Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iCloud] Changes in device Id in iCloud API
2 participants