Repository navigation
Follow re-paired mobile apps, and raise a repair rather than snooze a missing notify action - #272
Merged
Merged
Conversation
… action - Rebuild the mobile app cache and each recipient's discovered devices when a mobile_app device or its notify action comes or goes (debounced), instead of only at startup. - A failed push to a device whose notify action no longer exists raises the recipient_mobile_app_not_found repair instead of a one day snooze, and the repair is cleared once the action is back. - Purging snoozes also drops device snoozes whose action has gone. Points 2 and 3 of rhizomatics#268. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HpGm4J89JSyWt3WC6CTe27
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.
Points 2 and 3 of #268, separate from #269 (point 1).
2. Mobile apps followed at runtime, not only at startup
HomeAssistantAPI.subscribe_mobile_app_changes()listens toEVENT_DEVICE_REGISTRY_UPDATED, limited to mobile_app devices, and tonotify.mobile_app_*actions being registered or removed. Both are debounced into a single callback, because HA registers a re-paired phone's new action a little after the device itself.build_mobile_app_cache()now starts from empty, so a device that has gone, or has been re-paired under a new name, drops out of the cache.Recipient.resolve_mobile_devices()is the existing discovery code moved out ofinitialize(). It starts again from the configuredmobile_deviceseach time and swaps the recipient'smobile_app_idtargets accordingly.PeopleRegistry.refresh_mobile_devices()runs it for everyone, and the engine calls that, pluspurge_snoozes(), on a change.3. A missing action gets a repair, not a snooze
mobile_pushraises therecipient_mobile_app_not_foundrepair from 13a2c9e for that recipient instead of snoozing the device for a day. Other failures still snooze, as before.Recipient.check_mobile_actions()is the startup check from 13a2c9e, made reusable. It now also clears the repair once the action is back, on the next refresh.purge_snoozes()also dropsMOBILEsnoozes whose action no longer exists, so a "paused" device left over from before a re-pair doesn't stay around for a day. It runs nightly and after a mobile app change.Tests
test_people.py: a watch re-paired under a new name while a configured iPad's app turns up. After a refresh the recipient has the iPad and the new watch, the targets match, and the iPad's repair is cleared.test_hass_api.py: the change subscription ignores other devices and other notify actions, and fires once for a phone paired together with its action, and once for it going away. The cache drops a removed device.test_snoozer.py: purge drops the snooze for a gone device and keeps the other one.test_engine.py: the change handler refreshes recipients and purges snoozes.test_transport_mobile_push.py::test_missing_mobile_action_is_not_an_errornow expects the repair and no snooze.All of them fail on main.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HpGm4J89JSyWt3WC6CTe27