Skip to content

feat: add RoomControl getters for climate device entities#760

Draft
lackas wants to merge 6 commits into
openviess:masterfrom
lackas:add-roomcontrol-climate-getters
Draft

feat: add RoomControl getters for climate device entities#760
lackas wants to merge 6 commits into
openviess:masterfrom
lackas:add-roomcontrol-climate-getters

Conversation

@lackas
Copy link
Copy Markdown
Contributor

@lackas lackas commented May 8, 2026

Summary

Extends the IoT-scope-only RoomControl class 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 empty commands dicts on every rooms.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 over fetch_all_features() (the IoT scope no longer exposes a rooms parent feature, see commentary in the design doc).
  • Temperature setpoints per program-level (comfort / normal / reduced for heating, normal / reduced for cooling, normal / comfort for perceived).
  • Room state flags: getRoomChildLockActive / getRoomChildLockStatus, getRoomWindowOpen (uses the modern rooms.X.sensors.openWindow path; the legacy rooms.X.sensors.window.openState is in the deprecation database).
  • Room configuration flags: getRoomOpenWindowDetectionEnabled, getRoomHydraulicBalancingEnabled, getRoomTrvAlgorithmEnabled.

Each method is wrapped with @handleNotSupported so per-account variation in which setpoints exist is handled cleanly (e.g. some accounts return comfort.heating, others don't).

Tests

  • Fixture extended from 8 to 32 entries: full feature coverage for both rooms in tests/response/RoomControl.json (568 lines).
  • 16 new test cases in tests/test_RoomControl.py cover every getter on both rooms.
  • ViCareServiceMock.fetch_all_features() added to support the room-id discovery scan.
  • Full suite: 728 passed, 30 skipped.

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.

lackas added 6 commits May 7, 2026 20:41
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant