Repository navigation
Conversation
Rebased onto master (2026.11.1) as a single commit. - hive.set_holiday_mode (start, end, temperature 7-35) and hive.cancel_holiday_mode services, with catch-up refreshes over the following five minutes and cleanup on unload. - Hub-level Holiday Mode (off/scheduled/active), Holiday Date Start and Holiday Date End sensors sharing one cached fetch, polled every 30 min; a failed fetch leaves them unavailable instead of dropping them. - Requires pyhive-integration 2.0.0b5 (holiday mode API, Pyhive#149, plus the SSO quote fix, Pyhive#169). 2.0.0b5 has no getTargetTemperature alias, so the current-temperature attributes call get_target_temperature. - strings.json, services.yaml and icons.json updated; en.json regenerated. - tests/test_holiday_mode.py; existing sensor tests account for the holiday sensors. 106 passed on pytest-homeassistant 2026.11.2 with pyhive-integration 2.0.0b5; script/lint --check passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f884845 to
0b2e622
Compare
|
Rebased onto 2026.11.1 and bumped the pin to This is still a draft only because master is on 1.0.10. Is there a rough plan for a stable 2.0? If it's some way off, I'm happy to backport #149 to 1.0.x (like #170 did for the SSO fix) so this can pin a stable release instead. Whichever suits you better. |
|
@nsleigh there is still more fixes that need to go into the Beta. I would back port it. Then I will pick it up from master and merge it back into dev where the 2.0 changes are. |
|
Specifically on this PR please could we move any service code into the services file now either keep the import from core and add your changes underneath them or copy the content of services.py from core and add your changes to it that way. if the import can be kept and your changes are added below it then that would be the best way. That way we don't add too much extra code to init.py which is mainly just start up code |
|
@claude Review this PR |
|
Claude finished @KJonline's task in 26s —— View job Review of PR #222: holiday mode services and sensorsI read the diff against Needs changing
Smaller points
SummaryFunctionally this looks good. Moving the services into |
|
@KJonline thank you. I will work on both changes. |
Addresses review on Pyhass#222: - Holiday services now live in services.py, below core's import, and are registered once from async_setup alongside core's boost services instead of per entry. Unloading one entry no longer removes them; with several Hive accounts the optional config_entry_id picks one. - set_holiday_mode rejects an end before (or in the same minute as) the start, or in the past. Naive times use Home Assistant's time zone. - Shared holiday state moves to holiday.py: the fetch cache is dropped after a service call, the catch-up timers replace the previous call's instead of piling up, and the sensors refresh on their own signal rather than every Hive entity's. - Errors: catch ClientError/TimeoutError as well; HiveReauthRequired starts a reauth flow from both the services and the sensors. Messages use translation keys. - Sensor names, icons and states move to strings.json/icons.json via translation_key; _update_from_result is an abstractmethod. - Pin pyhive-integration==1.0.11 (holiday mode backport, Pyhass/Pyhive 1.0.x) and go back to getTargetTemperature, which 1.0.x provides. - Tests for two entries, the date checks, naive times, reauth, the cache and timer replacement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The sensors only refreshed around a service call, so a holiday ending (or starting after a restart, or set from the Hive app) showed the old state until the 30-minute poll. Each fetch that finds holiday mode scheduled or active now sets a refresh for its start and end; once either has passed, the catch-up refreshes run, because Hive can take a while to flip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks. Both done:
I also worked through the review points:
On the error types: While testing I found the sensors only refreshed around a service call. A holiday ending on its own, or one set in the Hive app, showed the old state until the 30-minute poll. They now refresh at the holiday's start and end too, and that survives restarts. I've tested all of this live on my own Hive with the backport bundled in. 124 tests pass and lint is clean. 🤖 Generated with Claude Code |
What does this change?
Adds Hive's whole-home holiday mode to the integration, using the hub holiday API from Pyhass/Pyhive#149 (backported to 1.0.x in Pyhass/Pyhive#194).
Services (in
services.py, registered once inasync_setupalongside core's boost services)hive.set_holiday_mode:start,endandtemperature(7–35 °C). Start and end are truncated to the minute, as in the Hive app. Times without an offset use Home Assistant's time zone. An end before (or in the same minute as) the start, or in the past, is rejected withServiceValidationError.hive.cancel_holiday_modeconfig_entry_id, needed only when more than one Hive account is set up.A rejected request or an API error is raised as
HomeAssistantErrorwith a translated message.HiveReauthRequiredstarts a reauth flow.Sensors (on the hub device, named through
translation_key)off/scheduled/active, withstart,endandtemperatureattributesThe shared state lives in
holiday.py:__init__.pyis unchanged frommaster.Library pin:
manifest.jsonpinspyhive-integration==1.0.11as a placeholder for the release that includes the backport. I'll update it to whatever version that ends up being. Until that's on PyPI, installing the requirements (and so CI) will fail, so this stays a draft. The current-temperature attributes are back ongetTargetTemperature, which 1.0.x has.I've been running this on my own system, with the 1.0.x backport bundled. I tested set, cancel, the date checks, and a holiday ending on its own after an HA restart. The sensors followed the Hive app each time.
Related issues
Relates to #73 (closed as not planned).
Checklist
Tests added or updated.
tests/test_holiday_mode.pycovers:ClientError/TimeoutErrorand reauth)conftest.pygives the mocked Hive a hub and a holiday response.script/test: 124 passed onpytest-homeassistant2026.11.2 with the 1.0.x backport installed.Lint passes (ruff check and format,
gen_translations.py --check).versionnot bumped.🤖 Generated with Claude Code