feat: add RoomControl getters for climate device entities#760
Draft
lackas wants to merge 6 commits into
Draft
Conversation
The RoomControl-driven Zigbee enrichment introduced in openviess#743 does not work in practice: the rooms.{id}.actors mapping that drives buildActorRoomMap() is not returned by the API for end users, so the enrichment is silently no-op and the lib has no reliable path to associate physical Zigbee devices with rooms. Removes the enrichment plumbing and reverts RoomSensor to direct sensor reads (device.sensors.temperature, device.sensors.humidity). RoomControl itself stays for direct per-room access. BREAKING CHANGE: RoomSensor no longer exposes hybrid getters that required RoomControl context (getRoomName, getRoomType, getCondensationRisk, getOperatingState*, getNormal/Reduced/Comfort HeatingTemperature, getManualTillNextSchedule*, getSchedule). Use the corresponding RoomControl methods with a room_id directly.
The previous fixture was an Internal-scope dump with features that the public IoT scope does not return (rooms parent, room metadata, schedules, operating programs, quickmodes). Removing it as a clean cut before bringing in a real IoT-scope fixture in the next commit.
The previous fixture and the matching RoomControl methods were sourced
from an Internal-scope dump. The features they relied on (rooms parent,
room metadata, schedules, operating programs, quickmodes) are not
returned by the public IoT scope used by all developer-portal
client_ids, so those methods silently fail for end users.
This commit cuts the loss to what actually works on IoT:
- New tests/response/RoomControl.json: 2 rooms, 8 features
(sensors.temperature, sensors.humidity, co2, condensationRisk per
room) sourced from a real IoT-scope dump.
- RoomControl reduced to four methods: getRoomTemperature,
getRoomHumidity, getRoomCO2, getRoomCondensationRisk.
- Bug fix: getRoomCO2 now reads rooms.{id}.co2 with property
concentration. Previously it read rooms.{id}.sensors.co2.value,
which the IoT scope does not return.
- Tests adjusted to the new fixture and surviving method set.
BREAKING CHANGE: Removed from RoomControl: getAvailableRooms,
getRoomActorIds, getRoomName, getRoomType,
getRoomOperatingState{Level,Demand,Reason},
getRoom{Normal,Reduced,Comfort}HeatingTemperature plus setters,
getRoomSchedule, getRoomManualTillNextScheduleActive plus
activate/deactivateRoomManualTillNextSchedule. These all relied on
features the IoT scope does not return.
Extends the IoT-scope-only RoomControl class with the read-only accessors needed by Home Assistant for per-room climate device entities: - getAvailableRoomIds() discovers active room indices via prefix scan - temperature setpoints per program-level (comfort/normal/reduced for heating + cooling, normal/comfort for perceived) - room state flags (childLock active+status, window-open sensor) - room configuration flags (open-window detection, hydraulic balancing, TRV algorithm) The existing getRoomWindowOpen uses the modern sensors.openWindow path; the legacy sensors.window.openState alternative is in the deprecation database with removal date 2024-09-15. Fixture extended from 8 to 32 entries covering all new features for both rooms; ViCareServiceMock.fetch_all_features() added to support the room-id discovery.
Adds the rooms.X.configuration.heatOnTime configuration flag exposed by the IoT API on RoomControl-equipped systems. Found in CFenner's account diagnostic dump but not in the smaller test setup, so it was missed in the initial PR.
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.
Summary
Extends the IoT-scope-only
RoomControlclass with read-only accessors needed by Home Assistant for the upcoming per-room "climate device" entities. All accessors are read-only because both diag dumps inspected so far (mine, plus a second contributor's) return emptycommandsdicts on everyrooms.X.*feature, and Viessmann's product owner confirmed via @CFenner that no functional per-eTRV or per-room setter exists on the public IoT scope.What's added
getAvailableRoomIds()discovers active room indices via prefix scan overfetch_all_features()(the IoT scope no longer exposes aroomsparent feature, see commentary in the design doc).comfort/normal/reducedfor heating,normal/reducedfor cooling,normal/comfortfor perceived).getRoomChildLockActive/getRoomChildLockStatus,getRoomWindowOpen(uses the modernrooms.X.sensors.openWindowpath; the legacyrooms.X.sensors.window.openStateis in the deprecation database).getRoomOpenWindowDetectionEnabled,getRoomHydraulicBalancingEnabled,getRoomTrvAlgorithmEnabled.Each method is wrapped with
@handleNotSupportedso per-account variation in which setpoints exist is handled cleanly (e.g. some accounts returncomfort.heating, others don't).Tests
tests/response/RoomControl.json(568 lines).tests/test_RoomControl.pycover every getter on both rooms.ViCareServiceMock.fetch_all_features()added to support the room-id discovery scan.Stack
Draft because this PR is stacked on top of #758. Once #758 merges, this rebases on master and the diff reduces accordingly. Marking ready-for-review at that point.