Skip to content

feat: expose device_type on PyViCareDeviceConfig#698

Open
lackas wants to merge 2 commits intoopenviess:masterfrom
lackas:feature/expose-device-type
Open

feat: expose device_type on PyViCareDeviceConfig#698
lackas wants to merge 2 commits intoopenviess:masterfrom
lackas:feature/expose-device-type

Conversation

@lackas
Copy link
Contributor

@lackas lackas commented Feb 3, 2026

Summary

  • Pass deviceType from API response through to PyViCareDeviceConfig
  • Add getDeviceType() method and device_type property
  • Add isGateway() convenience method

Motivation

Fixes #565 - The Viessmann API may return devices in unpredictable order. Users with multiple devices (e.g., gateway + heating) using devices[0] may get unexpected results when the gateway appears first.

With this change, users can filter devices by type:

heating_devices = [d for d in vicare.devices if not d.isGateway()]
# or
heating_devices = [d for d in vicare.devices if d.getDeviceType() == "heating"]

Test plan

  • Added 5 unit tests for getDeviceType() and isGateway()
  • All 516 tests pass

Pass deviceType from API response through to PyViCareDeviceConfig,
allowing users to filter devices by type.

Adds:
- device_type property on PyViCareDeviceConfig
- getDeviceType() method
- isGateway() convenience method

This helps users who have multiple devices (e.g., gateway + heating)
where the API may return them in unpredictable order.

Fixes openviess#565
PyViCareDeviceConfig is a data-holding class where the number of
constructor parameters is appropriate for its purpose.
@lackas
Copy link
Contributor Author

lackas commented Feb 3, 2026

Fixed the pylint failure by adding an inline disable comment.

If you'd prefer a different approach, I'm happy to refactor to use a @dataclass or pass parameters via a config object instead. Let me know!

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.

Order of devices changed

1 participant