Repository navigation
Avoid all-sensor refresh for sleep-confidence updates - #7753
chipsfromhell wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Hello @chipsfromhell,
When attempting to inspect the commits of your pull request for CLA signature status among all authors we encountered commit(s) which were not linked to a GitHub account, thus not allowing us to determine their status(es).
The commits that are missing a linked GitHub account are the following:
06312c1952137ec3cca7a73e7ae9d2b4baf447a8- This commit has something that looks like an email address (gwen@localhost). Maybe try linking that to GitHub?.
Unfortunately, we are unable to accept this pull request until this situation is corrected.
Here are your options:
-
If you had an email address set for the commit that simply wasn't linked to your GitHub account you can link that email now and it will retroactively apply to your commits. The simplest way to do this is to click the link to one of the above commits and look for a blue question mark in a blue circle in the top left. Hovering over that bubble will show you what email address you used. Clicking on that button will take you to your email address settings on GitHub. Just add the email address on that page and you're all set. GitHub has more information about this option in their help center.
-
If you didn't use an email address at all, it was an invalid email, or it's one you can't link to your GitHub, you will need to change the authorship information of the commit and your global Git settings so this doesn't happen again going forward. GitHub provides some great instructions on how to change your authorship information in their help center.
- If you only made a single commit you should be able to run
(substituting "Author Name" and "
git commit --amend --author="Author Name <email@address.com>"email@address.com" for your actual information) to set the authorship information. - If you made more than one commit and the commit with the missing authorship information is not the most recent one you have two options:
- You can re-create all commits missing authorship information. This is going to be the easiest solution for developers that aren't extremely confident in their Git and command line skills.
- You can use this script that GitHub provides to rewrite history. Please note: this should be used only if you are very confident in your abilities and understand its impacts.
- Whichever method you choose, I will come by to re-check the pull request once you push the fixes to this branch.
- If you only made a single commit you should be able to run
We apologize for this inconvenience, especially since it usually bites new contributors to Home Assistant. We hope you understand the need for us to protect ourselves and the great community we all have built legally. The best thing to come out of this is that you only need to fix this once and it benefits the entire Home Assistant and GitHub community.
Thanks, I look forward to checking this PR again soon! ❤️
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
There was a problem hiding this comment.
🟡 Changes recommended
The targeted update path treats rejected sleep-confidence updates as sent, suppressing retries; it needs failure-state cleanup and regression coverage.
1 open issue
What changed in this PR
This PR routes sleep-confidence callbacks through the existing single-sensor update path, avoiding refreshes of unrelated sensor managers.
Changes:
- Replaces the all-sensor refresh request with a targeted broadcast after saving confidence data.
- Adds callback tests for persistence, permissions, disabled sensors, and sleep-segment handling.
- Adds targeted-delivery tests for enabled, registered, and changed-value filtering.
| File | Description |
|---|---|
common/src/test/kotlin/io/homeassistant/companion/android/common/sensors/SensorUpdaterTargetedTest.kt |
Tests targeted delivery filtering and payloads. |
app/src/testFull/kotlin/io/homeassistant/companion/android/sensors/ActivitySensorManagerTest.kt |
Tests sleep callbacks, persistence order, and broadcast behavior. |
app/src/full/kotlin/io/homeassistant/companion/android/sensors/ActivitySensorManager.kt |
Requests targeted sleep-confidence delivery instead of refreshing all sensors. |
Review effort: Balanced
| // Send sleep confidence immediately without refreshing unrelated sensor managers. | ||
| applicationContext.sendBroadcast( | ||
| Intent(applicationContext, SensorReceiver::class.java).apply { | ||
| action = ACTION_UPDATE_SENSOR |
06312c1 to
f3b79c7
Compare
There was a problem hiding this comment.
It seems you haven't yet signed a CLA. Please do so here.
Once you do that we will be able to review and accept this pull request.
Thanks!
AI-Generated-By: Gwen (Hermes Agent)
Use registration metadata to avoid persisting a missing sensor row's default after a rejected targeted update. Exercise the real repository fallback with mocked DAOs, retaining existing-row reset and per-server success coverage. AI-Generated-By: Gwen (Hermes Agent)

Summary
A sleep-confidence event currently calls
updateAllSensorsafter saving its value. That refreshes unrelated sensor managers, including Health Connect, for each confidence callback.This changes the callback to request the existing
ACTION_UPDATE_SENSORpath forsleep_confidenceinstead. The confidence value and attributes are still saved before requesting delivery. Normal all-sensor refresh and registration are unchanged.The targeted path sends changed state or icon values for enabled, registered sensors. It does not force registration or send attribute-only changes. Those retain the existing normal-refresh behaviour. Sleep-segment processing is unchanged, but a combined callback no longer incidentally requests an immediate all-sensor send.
Checklist
Select exactly one option that describes AI usage in this contribution:
Any other notes
Automated checks:
The code and tests were generated with AI tools and received a separate AI code review. No on-device testing has been performed. This change removes the all-manager refresh request from sleep-confidence callbacks. It does not eliminate all Health Connect permission checks or establish a quota or battery-life improvement.