Add time synchronization feature to BSB-Lan integration#156600
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds a time synchronization feature to the BSB-Lan integration, allowing Home Assistant to synchronize its time with the BSB-Lan device once per hour when enabled via a new configuration option.
Key Changes
- Adds user-configurable time synchronization option (
sync_time) in the options flow - Implements hourly time synchronization logic with graceful error handling
- Includes comprehensive test coverage for the new feature
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
homeassistant/components/bsblan/__init__.py |
Implements time sync logic with async_setup_time_sync function and update listener for option changes |
homeassistant/components/bsblan/const.py |
Adds new constants for sync time option, default value, and hourly sync interval |
homeassistant/components/bsblan/config_flow.py |
Adds options flow handler with schema for time sync configuration |
homeassistant/components/bsblan/strings.json |
Adds user-facing strings for the time sync option |
tests/components/bsblan/test_init.py |
Adds comprehensive tests covering enabled/disabled states, time synchronization behavior, error handling, and periodic sync |
tests/components/bsblan/test_config_flow.py |
Adds tests for the options flow configuration |
tests/components/bsblan/fixtures/time.json |
Adds test fixture for device time data |
joostlek
requested changes
Nov 14, 2025
Member
joostlek
left a comment
There was a problem hiding this comment.
Wouldn't it be better to have this as a:
- Button
- Service
Instead of something that runs on boot?
Contributor
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Contributor
Author
737e324 to
487c56b
Compare
c0ef6ae to
d423ce0
Compare
Merged
8 tasks
joostlek
requested changes
Dec 1, 2025
d423ce0 to
5e61af4
Compare
3826d77 to
7aad879
Compare
67b1744 to
713f635
Compare
713f635 to
78015a1
Compare
joostlek
approved these changes
Jan 2, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Breaking change
Proposed change
This pull request adds a new
sync_timeservice to the BSB-LAN integration in Home Assistant, allowing users to synchronize the time on their BSB-LAN device with Home Assistant. The implementation includes service registration, validation, error handling, user-facing descriptions, and comprehensive tests.Key changes:
New Service Implementation:
Added the
sync_timeservice, which updates the BSB-LAN device time to match Home Assistant, only performing the update if the times differ. This includes schema validation, device/config entry checks, and error handling for device communication issues. [1] [2] [3] [4] [5]Registered an appropriate Material Design Icon for the new service in
icons.json.User Interface and Documentation:
services.yamlandstrings.jsonto document the new service, including its description, fields, and error messages for failed sync attempts. [1] [2] [3]Testing:
sync_timeservice, covering successful syncs, no-op when times match, error conditions (such as device or entry not found, or device communication failures), and service registration. Also added a device time fixture for test consistency. [1] [2] [3] [4] [5] [6]These changes ensure that users can reliably keep their BSB-LAN device clocks in sync with Home Assistant, with clear feedback and robust error handling.
Type of change
Additional information
Checklist
ruff format homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all.To help with the load of incoming pull requests: