Add issue sensors to Overseerr integration#158888
Add issue sensors to Overseerr integration#158888joostlek merged 6 commits intohome-assistant:devfrom
Conversation
|
Hey there @joostlek, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Implementation PlanThis PR is part 1 of a 2-part implementation for comprehensive issue management in Overseerr. DependenciesThis PR depends on python-overseerr#291 which adds the issue management API methods to the python-overseerr library (v0.8.0). PR Split RationalePer the review process guidelines, sensor changes and service introductions should be in separate PRs. This allows for:
Implementation Sequence
What's in This PR
What's NOT in This PR (coming in part 2)
|
|
I published v0.8.0, please bump in a separate PR |
|
I've split out the dependency bump into #158924 as requested. Once that's merged, this PR will be ready for review. The updated order is:
|
20d7c65 to
47bcdb7
Compare
|
|
||
|
|
||
| class OverseerrCoordinator(DataUpdateCoordinator[RequestCount]): | ||
| class OverseerrCoordinator(DataUpdateCoordinator[OverseerrData]): |
There was a problem hiding this comment.
I think it would be nice to split up the coordinators so we can specifically only update the parts that need it. I am happy to help with this part, but justletting it know
There was a problem hiding this comment.
Do we want to split them in this PR or in another PR, after this one? I'm good with either approach.
There was a problem hiding this comment.
I think I'd rather do it in this PR.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
I'll get these added |
|
I've added comprehensive tests for the coordinator in commit 493ea08. The test coverage now includes:
|
joostlek
left a comment
There was a problem hiding this comment.
Feel free to message me on Discord btw
|
|
||
|
|
||
| class OverseerrCoordinator(DataUpdateCoordinator[RequestCount]): | ||
| class OverseerrCoordinator(DataUpdateCoordinator[OverseerrData]): |
There was a problem hiding this comment.
I think I'd rather do it in this PR.
| "iot_class": "local_push", | ||
| "quality_scale": "platinum", | ||
| "requirements": ["python-overseerr==0.7.1"] | ||
| "requirements": ["python-overseerr==0.8.0"] |
There was a problem hiding this comment.
We bumped this in a separate PR right?
| ), | ||
| OverseerrSensorEntityDescription( | ||
| key="total_issues", | ||
| native_unit_of_measurement=ISSUES, |
There was a problem hiding this comment.
Oh we can move the unit of measurement to the translations and then we can translate it :)
There was a problem hiding this comment.
We don't want to test the coordinator directly, instead we should observe it via the state machine, like we do in the snapshot test (that's why test_sensor.ambr is updated).
Also, I think that we should have a test where we get an issue related webhook and observe what that does
Add 6 new sensors to track issues in Overseerr: - Total issues - Open issues - Closed issues - Video issues - Audio issues - Subtitle issues Update coordinator to fetch both request and issue counts. Add webhook support for issue notifications.
Add test coverage for the OverseerrCoordinator including: - Successful data fetch for both requests and issues - Authentication error handling - Connection error handling - Data refresh functionality - Proper exception raising (ConfigEntryAuthFailed, UpdateFailed) Also add issue_count.json test fixture and update conftest to mock get_issue_count API method.
Update test assertions to use actual values from request_count.json fixture instead of hardcoded incorrect values.
- Update REGISTERED_NOTIFICATIONS value from 222 to 4062 (now includes issue notifications) - Remove 'Bigger scope' test case as we now use all notification types - Update webhook_config.json fixture with new notification types value - Update snapshots for new issue sensors - All 52 tests passing with 100% coverage
Replace placeholder 'none' entity IDs with proper translation-key-based IDs: - sensor.overseerr_none → sensor.overseerr_total_issues - sensor.overseerr_none_2 → sensor.overseerr_open_issues - sensor.overseerr_none_3 → sensor.overseerr_closed_issues - sensor.overseerr_none_4 → sensor.overseerr_video_issues - sensor.overseerr_none_5 → sensor.overseerr_audio_issues - sensor.overseerr_none_6 → sensor.overseerr_subtitle_issues This fixes CI test failures on Python 3.14.2 where snapshots were not found.
- Move unit_of_measurement from hardcoded ISSUES constant to translation strings - Remove ISSUES constant from const.py (no longer needed) - Add 'state.measurement' translations for all 6 issue sensors - Remove direct coordinator tests (test via state machine instead) - Add webhook test for issue events (test_webhook_issue_trigger_update) - Fix webhook handler to refresh coordinator for REQUEST_ and ISSUE_ events - Add webhook_issue_reported.json test fixture - Update snapshots for new unit_of_measurement approach This allows the unit 'issues' to be translated to different languages.
9bca18c to
cb6bed5
Compare
Description
This PR adds 6 new sensors to track issue statistics in Overseerr. This is the first part of comprehensive issue management functionality - service actions will be added in a separate PR per review guidelines.
Note: This PR is now based on #158924 and depends on it being merged first.
Changes
New Sensors
Technical Changes
Dependencies
Type of change
Additional information
Checklist
Related Issues/PRs