Repository navigation
Conversation
The camelCase -> snake_case rename left compat_aliases.py covering only setters (setMode, setBoostOn, ...) plus getClimate/getLight/etc. Home Assistant core's built-in hive sensor/binary_sensor platforms are written against the old camelCase API and call getter methods directly (e.g. hive.heating.getMode(device)) to populate diagnostic entities such as Mode, State, and Boost sensors, and the hub's Smoke/Dog Bark/Glass Break binary_sensors. Those calls now raise AttributeError since the methods only exist as get_mode()/get_state()/etc, so the entities silently stop updating and go unavailable after the object holding the last cached state is dropped (e.g. on next HA restart). Current/Target Temperature sensors were unaffected because core reads those from the pre-computed device.status dict rather than calling a getter directly. Also fixes an existing gap: WaterHeaterCompatMixin only offered the snake_case get_boost (still used by the Hotwater_Boost sensor), not the camelCase getBoost that HA core calls, so it now provides both. Changes: - HeatingCompatMixin: add getMinTemperature, getMaxTemperature, getCurrentTemperature, getTargetTemperature, getMode, getState, getCurrentOperation, getBoostStatus, getBoostTime, getHeatOnDemand, setHeatOnDemand, getOperationModes, getScheduleNowNextLater, minmaxTemperature - WaterHeaterCompatMixin: add getBoost alongside get_boost (bugfix), getBoostTime, getMode, getState, getOperationModes, getScheduleNowNextLater - LightCompatMixin: add getState, getBrightness, getMinColorTemp, getMaxColorTemp, getColorTemp, getColor, getColorMode - SwitchCompatMixin: add getState, getPowerUsage, getSwitchState - SensorCompatMixin: add getState - ActionCompatMixin: add getState - New HubCompatMixin (getSmokeStatus, getDogBarkStatus, getGlassBreakStatus), wired into HiveHub in devices/hub.py Verified in a Home Assistant instance: all previously-unavailable sensor.*_mode / sensor.*_boost / sensor.*_state entities (10 TRVs + thermostat) and the hub's binary_sensor.hive_hub_status came back after this change, with no regressions to entities that were already working. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The alias commit only tested getBoost, leaving 34 new delegates uncovered and dropping total coverage to 98.95%, below the 99% fail_under gate. Add one parametrized test asserting each alias calls its snake_case method with the same arguments and returns its result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #158 +/- ##
=======================================
Coverage 99.96% 99.96%
=======================================
Files 30 30
Lines 2571 2643 +72
Branches 297 297
=======================================
+ Hits 2570 2642 +72
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
🤖 Claude Code ReviewLGTM: no bugs found. Every new camelCase alias delegates to a snake_case method that exists on the class using the mixin (checked against
Not reviewed: I did not fetch the Home Assistant source, so I did not check that these aliases match the calls HA makes. Automated review by Claude Code · workflow run |
@claude can you check this against the home assistant source |
|
Claude finished @KJonline's task in 20s —— View job Couldn't check against the Home Assistant sourceI couldn't fetch the Home Assistant source, so I haven't done the check you asked for.
Fix: add What I'd check once I can read HA's code:
|
@claude can you check this against the home assistant source |
|
Claude finished @KJonline's task in 39s —— View job Checked against Home Assistant
|
| HA file | Call | Alias in compat_aliases.py |
|---|---|---|
sensor.py, binary_sensor.py |
self.device = await self.hive.sensor.getSensor(self.device) |
getSensor (l.223) |
sensor.py, binary_sensor.py, climate.py, water_heater.py, light.py, switch.py |
await self.hive.session.updateData(self.device) |
updateData (l.282) |
sensor.py, light.py |
hive.session.deviceList.get("sensor") / .get("light") |
deviceList (l.274) |
__init__.py |
await hive.session.startSession(hive_config) |
startSession (l.278) |
climate.py |
heating.setMode, setTargetTemperature, setBoostOn(device, mins, temp), setBoostOff, getClimate |
all present |
water_heater.py |
hotwater.setMode, setBoostOn(device, mins), setBoostOff, getWaterHeater |
all present |
light.py |
light.turnOn(device, brightness, color_temp, color), turnOff, getLight |
all present |
switch.py |
switch.turnOn, turnOff, getSwitch |
all present |
Every one of these is awaited, and the aliases are all async def, so they match. hive.session resolves because src/hive.py:42 sets self.session = self.
Where the PR description doesn't match HA dev
sensor.pyandbinary_sensor.pynever callgetMode,getState,getBoost,getBoostStatus,getSmokeStatusand so on. They callgetSensor()and readdevice["status"]["state"].sensor.py's update code isself.entity_description.fn(self.device.get("status", {}).get("state")).manifest.jsonpinspyhive-integration==1.0.9, imports arefrom apyhiveapi import Hive, and the codeowners are@Rendiliand@KJonline.- So on HA
dev, the Mode / State / Boost sensors and the hub Smoke / Dog Bark / Glass Break sensors don't depend on these getters. Per this check, nothing in HAdevcalls the new aliases (getBoost,getBoostTime,getOperationModesand the rest).
What this means
- The PR is harmless and the aliases are correctly delegated, so there's no bug. But the justification isn't supported by HA
dev. - The unavailable sensors you saw on the live install most likely come from a different HA version or a custom or older
hivecomponent that calls these getters. I couldn't check which one. If so, please say which, and I'll check that source instead. - If the failure was real on a stock HA install, the cause may be elsewhere. For example,
getSensormay not populatestatus["state"]for those device types. I can look atsrc/devices/sensor.pyif you share the failing entity names or the log error. - If the aliases are meant for back-compat with older HA releases, I'd reword the PR description. It currently says HA core's
sensor/binary_sensorplatforms call them.
Not checked: config_flow.py, entity.py and const.py. __init__.py also calls Auth(...).forget_device(access_token, device_key). It's awaited, and device_registration.py:319 defines it as async def.
|
@nsleigh can you share the errors you are seeing as the review above im don't think home assistant calls these endpoints and see them failing. I have checked my beta custom component version I released via HACS and Im not see any errors related to the method missing. If you could share the errors that would be much appreciated. I am seeing an error related to mode in my custom component beta version but that is to do with keys in a dictionary not the method. I don't seem any harm merging this im just curious to why your seeing errors im not. |
|
@KJonline to be honest I don't remember, I worked on this quite a long time ago and only submitted the PRs once I was sure it was working. I was using Claude to do the work and I had it "vendored" so it may not have been genuine. I asked Claude to explain the change and it suggest this:
In my vendored source it said:
So bottom line is I relied on Claude and assumed it was right! |
|
@nsleigh ill close the PR as older versions of the integration will be pinned to older versions of the library and not this new one. if your up for it would be good if you could try out the beta released. thanks for raising this anyway it’s always good to see people proposing fixes for this stuff. |
|
@KJonline is the beta 2026.10.1.B1 will that pull in the holiday mode code? |
|
@nsleigh that’s the correct beta version yes. Yes your holiday code did make it into the last beta cut. It exists in the backend code but I hadn’t done any changes to the custom component code to support it yet. |
Summary
The camelCase → snake_case rename left
helper/compat_aliases.pycovering only the setters (setMode,setBoostOn, …) plusgetClimate/getLight/etc. Most getters were never aliased.Home Assistant core's built-in
hiveintegration (sensor/binary_sensorplatforms) still uses the camelCase API. It calls getters directly for its diagnostic entities, e.g.hive.heating.getMode(device). With this library ondev, those calls raiseAttributeError. As a result, these entities gounavailable:Current/Target Temperature keep working because core reads them from the pre-computed
device.statusdict instead of calling a getter.Changes
All changes are in
src/helper/compat_aliases.pyexcept theHiveHubwiring. Every new method is a one-line delegate to its existing snake_case method.getMinTemperature,getMaxTemperature,getCurrentTemperature,getTargetTemperature,getMode,getState,getCurrentOperation,getBoostStatus,getBoostTime,getHeatOnDemand,setHeatOnDemand,getOperationModes,getScheduleNowNextLater,minmaxTemperaturegetBoost,getBoostTime,getMode,getState,getOperationModes,getScheduleNowNextLatergetState,getBrightness,getMinColorTemp,getMaxColorTemp,getColorTemp,getColor,getColorModegetState,getPowerUsage,getSwitchStategetStateHubCompatMixin:getSmokeStatus,getDogBarkStatus,getGlassBreakStatus, mixed intoHiveHubinsrc/devices/hub.pyNote on
WaterHeaterCompatMixin.get_boostThe existing alias was named
get_boost(snake_case), but HA core callsgetBoost. This PR addsgetBoostand keepsget_boost, becausedevices/sensor.py(Hotwater_Boost) still calls the snake_case name. Renaming it instead would break that sensor.Testing
test_camelcase_get_boost_delegates_to_get_boost_status. The full suite passes (1023 tests).dev.🤖 Generated with Claude Code