-
-
Notifications
You must be signed in to change notification settings - Fork 238
Implement IOT Time Module Failover #1583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Implement IOT Time Module Failover #1583
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Implements failover logic for the IOT Time Module to handle cases where system default timezone files don't contain the correct timezone information. The PR adds the ability to guess timezone based on UTC offset and DST behavior when ZoneInfo is not available on the host.
- Enhanced timezone lookup with fallback mechanisms using offset-based matching
- Added DST behavior detection to improve timezone selection accuracy
- Improved error handling for missing timezone data with graceful degradation
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| kasa/iot/modules/time.py | Updated _post_update_hook to implement failover logic with offset-based timezone guessing |
| kasa/iot/iottimezone.py | Added new functions for DST detection, offset-based timezone guessing, and improved error handling |
| tests/test_common_modules.py | Added comprehensive unit tests for the new failover functionality |
| tests/iot/test_iottimezone.py | Added unit tests for the new timezone utility functions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1583 +/- ##
==========================================
+ Coverage 92.82% 93.07% +0.24%
==========================================
Files 157 157
Lines 9649 9715 +66
Branches 976 986 +10
==========================================
+ Hits 8957 9042 +85
+ Misses 492 480 -12
+ Partials 200 193 -7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I have validated this code against my own devices and observed that it solves #1579 |
|
This should also close out PR[#1554]. |
|
@rytilahti This looks good from my end. |
This PR creates failover in the IOT Time Module to handle issues where the system default time zone files don't have the correct time zone info.