Repository navigation
Conversation
Adds whole-home holiday mode support on top of pyhive-integration's hub holiday API (Pyhass/Pyhive#149, first released in 2.0.0b4): - hive.set_holiday_mode (start, end, temperature 7-35) and hive.cancel_holiday_mode services. Start/end are truncated to the minute, matching the Hive app; failures raise HomeAssistantError. - Holiday Mode (off/scheduled/active), Holiday Date Start and Holiday Date End sensors on the hub. They share one cached fetch, poll every 30 minutes, refresh at a scheduled start, and run a short catch-up burst after set/cancel because Hive's backend lags the request. A partial API response keeps the last known start/end/temperature. - Services, and any pending catch-up refreshes, are removed on unload. - Requires pyhive-integration==2.0.0b4. Every hive.<object>.<method> call the integration makes was checked to exist in 2.0.0b4. Tests: new tests/test_holiday_mode.py; the mocked Hive now has a hub and holiday response, and two "no sensors" assertions now allow the hub's holiday sensors. The 4 failures that already occur on master (test_setup_failures x2, test_translations x2) are unchanged. Ported from nsleigh/Hive-Custom-Component feature/vendor-apyhiveapi-dev (a2ac9b9, 1e4e88a, 4ae6cba, fe2d5a9, b24c3da, 57c1ff3), without the vendored library or unrelated fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 of 3 tasks
The holiday mode sensors are added with update_before_add, so an exception from get_holiday_mode() during setup (e.g. Hive's cloud timing out at boot) stopped HA adding them at all until the next restart. Catch TimeoutError, aiohttp ClientError and HiveApiError in async_update and go unavailable instead; the 30-minute poll and dispatcher refreshes bring them back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
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.
What does this change?
Adds Hive's whole-home holiday mode to the integration, building on the hub holiday API added to the library in Pyhass/Pyhive#149.
Services
hive.set_holiday_mode:start,endandtemperature(7–35 °C). Start and end are truncated to the minute, as in the Hive app.hive.cancel_holiday_modeA rejected request or an API error is raised as
HomeAssistantError.Sensors (on the hub device)
off/scheduled/active, withstart,endandtemperatureattributesThe three sensors share one cached fetch and poll every 30 minutes. They also refresh at a scheduled start and a few times after a set or cancel, because Hive's backend takes a few minutes to change state. If Hive omits start, end or temperature from a response, the last known values are kept.
The services and any pending refreshes are removed when the entry unloads.
Depends on a library beta. This needs
pyhive-integration==2.0.0b4, the first release containing #149, somanifest.jsonis pinned to it. I've opened this as a draft until a 2.0 release is ready. I checked that everyhive.<object>.<method>call in the integration exists in 2.0.0b4.I've been running this code on my own system since July (on a fork that bundles the library). This PR contains only the holiday mode changes, plus the cleanup on unload, which is new.
Related issues
Relates to #73 (closed as not planned).
Checklist
tests/test_holiday_mode.pycovers the sensor states, partial responses, unavailability, both services, error handling, temperature validation and cleanup on unload.conftest.pynow gives the mocked Hive a hub and a holiday response, and two "no sensors" assertions now allow for the hub's holiday sensors.script/test: run locally against 2.0.0b4, 90 pass and 4 fail. The same 4 fail onmaster(test_setup_failures×2,test_translations×2).script/lint --check: this PR adds no new lint or formatting issues; the ones already onmasterare unchanged. I haven't regeneratedtranslations/en.json, because doing so rewrites the whole file and would undo its restoration in 5e63418. I can add that here or in a separate PR if you'd like.versionnot bumped. This isn't meant for a release yet.🤖 Generated with Claude Code