Conversation
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds basic support for retrieving device schedules from the Roborock API, contributing to issue #346. The implementation follows established patterns in the codebase and includes proper test coverage. Note that schedule updating functionality is intentionally left for future work, as it requires more complex data handling.
Key Changes:
- Added
HomeDataScheduledata container with schedule attributes (id, cron, repeated, enabled, param) - Implemented
get_schedules()API method to retrieve schedules for a specific device - Added comprehensive test coverage with mock API responses
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| roborock/data/containers.py | Adds HomeDataSchedule dataclass to represent schedule data with cron expression, repeat status, and enabled flag |
| roborock/web_api.py | Implements get_schedules() method that fetches schedules from the /user/devices/{device_id}/jobs endpoint |
| tests/test_web_api.py | Adds test_get_schedules() with mock response data to verify schedule retrieval functionality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
roborock/web_api.py
Outdated
| if isinstance(schedules, list): | ||
| return [HomeDataSchedule.from_dict(schedule) for schedule in schedules] | ||
| else: | ||
| raise RoborockException("scene_response result was an unexpected type") |
There was a problem hiding this comment.
The error message refers to "scene_response" but this is in the get_schedules method. It should refer to "schedules_response" or "schedules result" to accurately describe what failed.
| raise RoborockException("scene_response result was an unexpected type") | |
| raise RoborockException("schedules_response result was an unexpected type") |
Co-authored-by: Allen Porter <allen.porter@gmail.com>
This adds some basic support towards #346
Updating is slightly more complicated, as you don't just send enabled/disabled but the entire data again. so I did not want to spend the time on it, but this should be a good basis for someone else to work off of or for me to come back to in the future.