Skip to content

Restore missing camelCase getter aliases for HA core compatibility #150

Description

@nsleigh

I am not sure if this is an issue or I am being led astray by AI. While working on the holiday mode I used the dev branch and vendored it so I could edit it locally. When I reloaded I lost the sensor._mode / sensor._boost / sensor._state entities - the binary_sensor. were still there. In addition the thermostat mode sensor wasn't available.

This is what Claude AI said:


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 bug: WaterHeaterCompatMixin.get_boost was
misnamed (should be getBoost, camelCase, matching master) so nothing
actually called it.

Changes:

  • HeatingCompatMixin: add getMinTemperature, getMaxTemperature,
    getCurrentTemperature, getTargetTemperature, getMode, getState,
    getCurrentOperation, getBoostStatus, getBoostTime, getHeatOnDemand,
    setHeatOnDemand, getOperationModes, getScheduleNowNextLater,
    minmaxTemperature
  • WaterHeaterCompatMixin: rename get_boost -> getBoost (bugfix), add
    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.


After making the changes it recommended everything started working.

As I said not sure if this is a bug or a design change but thought I'd report it anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions