FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Implement IOT Time Module Failover by ZeliardM · Pull Request #1583 · python-kasa/python-kasa · GitHub

Implement IOT Time Module Failover - #1583

Merged
rytilahti merged 10 commits into
python-kasa:masterfrom
ZeliardM:feature/iot-timezone-failover
Feb 22, 2026
Merged

Implement IOT Time Module Failover#1583
rytilahti merged 10 commits into
python-kasa:masterfrom
ZeliardM:feature/iot-timezone-failover

Conversation

ZeliardM commented Oct 8, 2025

Copy link
Copy Markdown
Collaborator

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.

Copilot AI review requested due to automatic review settings October 8, 2025 20:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Comment thread kasa/iot/iottimezone.py Outdated
Comment thread tests/test_common_modules.py Outdated

codecov Bot commented Oct 8, 2025
edited
Loading

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.22%. Comparing base (30a8fd4) to head (227263f).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1583      +/-   ##
==========================================
+ Coverage   92.98%   93.22%   +0.24%     
==========================================
  Files         157      157              
  Lines        9750     9815      +65     
  Branches      992     1002      +10     
==========================================
+ Hits         9066     9150      +84     
+ Misses        484      472      -12     
+ Partials      200      193       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

danielhoherd commented Oct 9, 2025
edited
Loading

Copy link
Copy Markdown

I have validated this code against my own devices and observed that it solves #1579

#1579 (comment)

Copy link
Copy Markdown
Collaborator Author

This should also close out PR[#1554].

Copy link
Copy Markdown
Collaborator Author

@rytilahti This looks good from my end.

rytilahti added the bug Something isn't working label Feb 21, 2026
rytilahti linked an issue Feb 21, 2026 that may be closed by this pull request

rytilahti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Did a very quick review, but I trust you this makes sense. Added a couple of very minor nits, feel free to adjust or just let me know and we will merge this as-is.

Comment thread kasa/iot/iottimezone.py
Comment thread kasa/iot/iottimezone.py Outdated
Comment thread kasa/iot/iottimezone.py Outdated

ZeliardM commented Feb 22, 2026
edited
Loading

Copy link
Copy Markdown
Collaborator Author

@rytilahti Yea, what this does is it takes what the SMART devices does for fallback and implements it into the IOT devices as well. The fallback for SMART and SMARTCAM devices uses the built-in offset from the device, which IOT does not have, so we calculate it here based on the device and system time to a best guess. It's not perfect but gets rid of the failures that were happening and gives a path to keep going without the hard failures like before without the TZDATA modules and with the changes to the base system time zones.

This should be cleaned up according to your comments and good to go now as well.

Copy link
Copy Markdown
Member

Sounds good to me, let's merge!

rytilahti merged commit 932f3e2 into python-kasa:master Feb 22, 2026
18 checks passed
rytilahti added enhancement New feature or request and removed bug Something isn't working labels Feb 22, 2026
ZeliardM deleted the feature/iot-timezone-failover branch February 22, 2026 20:10
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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'No time zone found with key EST' in debian 13

4 participants


Back | FazBrowse Home | New Git URL