Fix Apple Shortcuts failing after iCloud sync between devices#1128
Open
Fix Apple Shortcuts failing after iCloud sync between devices#1128
Conversation
The OpenHABHome shortcut parameter stored a device-local UUID as its identifier. Since UUIDs are generated independently on each device, shortcuts synced via iCloud could not resolve the home on the second device, resulting in "Invalid home" errors. Replace the UUID with a stable cross-device identifier derived from the home's connection configuration: cloudUserId (for myopenhab.org accounts), remote URL (for self-hosted servers), or local URL as a fallback. This identifier is identical on every device configured for the same openHAB instance, so synced shortcuts resolve automatically. Legacy shortcuts that stored a UUID are migrated transparently: the lookup falls back to UUID matching on first run, then Shortcuts saves the new stable identifier format going forward. Fixes #1125 Signed-off-by: Tim Mueller-Seydlitz <timbms@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1125
Shortcuts created on one device fail on another with "Invalid home: the value provided for home in Get Item State was invalid" after iCloud sync.
Root cause:
OpenHABHome.identifierstored a device-local UUID. UUIDs are generated independently on each device, so the UUID stored in a synced shortcut has no match in the second device'sstoredHomes.Fix: Replace the UUID with a stable cross-device identifier derived from the home's connection configuration:
cloudUserId(unique per cloud account)This identifier is identical on every device configured for the same openHAB server, so iCloud-synced shortcuts resolve correctly without any user action.
Migration: Shortcuts created before this fix stored a UUID. The lookup now falls back to UUID matching transparently on first run, then Shortcuts saves the new stable identifier format going forward — no user intervention needed.
Changes
OpenHABIntentHelper: newstableIdentifier(for:)andresolveHomeId(for:)helpers; updatedresolveHome,getHomeOptions, andgetAllItemsto use themPreferences.shared.storedHomes[UUID]lookup withresolveHomeId(for:), which handles both new and legacy identifier formatsTest plan