Skip to content

Add service for setting hot water schedule#156112

Merged
joostlek merged 14 commits into
home-assistant:devfrom
liudger:add-service-hotwater-schedule
Dec 29, 2025
Merged

Add service for setting hot water schedule#156112
joostlek merged 14 commits into
home-assistant:devfrom
liudger:add-service-hotwater-schedule

Conversation

@liudger
Copy link
Copy Markdown
Contributor

@liudger liudger commented Nov 8, 2025

Breaking change

Proposed change

This pull request adds a new "Set Hot Water Schedule" service to the BSB-Lan integration, allowing users to configure daily hot water heating schedules for their devices through Home Assistant. The implementation includes backend service logic, schema and selector definitions for the service fields, icons, and user-facing strings for validation and error handling.

New Service Implementation

  • Added the set_hot_water_schedule service, enabling users to specify time slots for hot water heating for each day of the week via the services.py module. This includes input validation, error handling, and integration with the BSB-Lan API.
  • Registered the new service during integration setup in __init__.py via the new async_setup_services function. [1] [2]

Service Schema and UI Integration

  • Defined the service schema and selectors in services.yaml, allowing users to input multiple time slots per day with start and end times for each.
  • Added an icon for the new service in icons.json for improved UI representation.

User-Facing Strings and Error Handling

  • Added localized exception and service descriptions to strings.json, including detailed error messages for invalid input and a description for the new service and its fields. [1] [2] [3]

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new service for the BSB-LAN integration to configure hot water heating schedules. The service allows users to set weekly schedules for hot water heating via service calls.

  • Implements set_hot_water_schedule service with device-based configuration
  • Adds comprehensive test coverage including success scenarios and error handling
  • Includes service registration in async_setup and proper cleanup on config entry unload

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
homeassistant/components/bsblan/services.py New service implementation with schedule validation and device lookup logic
tests/components/bsblan/test_services.py Comprehensive test suite covering success cases and error scenarios
homeassistant/components/bsblan/__init__.py Integration setup with service registration and cleanup logic
homeassistant/components/bsblan/strings.json Service descriptions and error message translations
homeassistant/components/bsblan/services.yaml Service schema definition with field selectors
homeassistant/components/bsblan/icons.json Service icon configuration

Comment thread homeassistant/components/bsblan/strings.json
Comment thread homeassistant/components/bsblan/__init__.py Outdated
Comment thread tests/components/bsblan/test_services.py Outdated
Comment thread homeassistant/components/bsblan/services.py
Comment thread homeassistant/components/bsblan/strings.json
@liudger liudger marked this pull request as draft November 8, 2025 20:22
@liudger liudger marked this pull request as ready for review November 9, 2025 17:43
@liudger liudger changed the title Add BSB-Lan service for setting hot water schedule Add service for setting hot water schedule Nov 9, 2025
Comment thread homeassistant/components/bsblan/__init__.py Outdated
Comment thread homeassistant/components/bsblan/services.py Outdated
Comment thread homeassistant/components/bsblan/services.py Outdated
Comment thread homeassistant/components/bsblan/services.py Outdated
Comment thread homeassistant/components/bsblan/services.yaml Outdated
@home-assistant
Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant Bot marked this pull request as draft November 10, 2025 15:26
@liudger liudger marked this pull request as ready for review November 11, 2025 14:54
@home-assistant home-assistant Bot requested a review from joostlek November 11, 2025 14:54
@liudger liudger force-pushed the add-service-hotwater-schedule branch 2 times, most recently from 0658fb4 to 95f3397 Compare November 16, 2025 11:08
Comment thread homeassistant/components/bsblan/services.py Outdated
Comment thread tests/components/bsblan/test_services.py Outdated
Comment thread tests/components/bsblan/test_services.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft December 1, 2025 16:39
…eck; add tests for string time formats and validation
…days and empty string for cleared days; update related tests for consistency.
@liudger liudger force-pushed the add-service-hotwater-schedule branch from 95f3397 to 87e7d04 Compare December 9, 2025 15:17
…meSlot objects; remove standard_values_slots from service definition and update related strings.
…nd TimeSlot objects; update expected values and error handling for improved clarity and consistency.
@liudger liudger marked this pull request as ready for review December 9, 2025 15:48
@home-assistant home-assistant Bot requested a review from joostlek December 9, 2025 15:48
@joostlek joostlek merged commit 3327c35 into home-assistant:dev Dec 29, 2025
35 of 36 checks passed
Comment on lines +213 to +217
hass.services.async_register(
DOMAIN,
SERVICE_SET_HOT_WATER_SCHEDULE,
set_hot_water_schedule,
)
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.

Where's the schema?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Let me check.

Copy link
Copy Markdown
Contributor Author

@liudger liudger Dec 30, 2025

Choose a reason for hiding this comment

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

added a schema @arturpragacz

#159990

It was not there because the api in bsblan did the validation. But it's better to do it directly in HA also.

@github-actions github-actions Bot locked and limited conversation to collaborators Dec 31, 2025
@liudger liudger deleted the add-service-hotwater-schedule branch January 2, 2026 14:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants