Skip to content

[viessmann] refactor channel commands and add units#20300

Merged
lsiepel merged 27 commits intoopenhab:mainfrom
rogrun:5.2.x-viessmann-refactor-channel-command-and-add-units
Mar 8, 2026
Merged

[viessmann] refactor channel commands and add units#20300
lsiepel merged 27 commits intoopenhab:mainfrom
rogrun:5.2.x-viessmann-refactor-channel-command-and-add-units

Conversation

@rogrun
Copy link
Contributor

@rogrun rogrun commented Feb 27, 2026

This PR has following changes:

  • Refactor channel command handling
  • Add units for KilowattPeak, Volt, Ampere, WattHour, meter, degree
  • Extended logging of unknown unit
  • Add support for hygiene function
  • Fix commands for holiday channels

@rogrun rogrun changed the title 5.2.x viessmann refactor channel command and add units [viessmann] refactor channel commands and add units Feb 27, 2026
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
…turesOfDevice method only in one handler

Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
@rogrun rogrun force-pushed the 5.2.x-viessmann-refactor-channel-command-and-add-units branch from 4186d6e to 9cd000f Compare February 27, 2026 09:42
@lolodomo lolodomo added the enhancement An enhancement or new feature for an existing add-on label Feb 28, 2026
@lsiepel lsiepel requested a review from Copilot March 1, 2026 09:34
@lsiepel
Copy link
Contributor

lsiepel commented Mar 1, 2026

@rogrun not sure if i asked before, but it would be appreciated if PR's are kept small, by seperating the bug fixes, refactoring and enhancements. This would make it simpler to review, backport, list changes in the release notes seperate and reduces the possibility of regressions.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the command handling for the Viessmann binding's device channels and adds support for several new physical units. It introduces a more generic, data-driven approach to parsing API commands using the new FeatureCommand/FeatureCommandParams DTOs, replacing the previous hard-coded FeatureCommands class with a flexible Map<String, FeatureCommand>. It also adds support for hygiene functions, fixes holiday channel commands, and improves timezone-awareness for scheduling.

Changes:

  • Replaces the monolithic FeatureCommands DTO with a generic map-based FeatureCommand model and refactors the entire command dispatch pipeline in DeviceHandler
  • Adds new channel types for watt-hour, kilowattpeak, volt, ampere, meter, degree, duration-minute, start-hour, and start-minute; adds new StoredChannelValues class for state caching across command calls
  • Fixes holiday channel command handling and adds hygiene function support; uses openHAB's configured timezone via ViessmannUtil.getOpenHABZoneId() replacing LocalTime.now() calls

Reviewed changes

Copilot reviewed 57 out of 57 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
thing-types.xml Adds new channel types for new units and bumps thing type version to 5
viessmann.properties Fills in blank i18n entries and adds command labels for hygiene mode values
ViessmannUtil.java Replaces old resource-reading helpers with hyphenToCamel() and timezone-aware getOpenHABZoneId()
JsonUtil.java + GsonJsonElementSerializer.java New Jackson-based JSON utilities for serializing Gson JsonElement trees (used for debug logging)
ViessmannGatewayHandler.java Delegates feature-update logic to ViessmannAccountHandler, makes linkRegistry nullable
ViessmannBridgeHandler.java Uses openHAB timezone for API call reset window
ViessmannAccountHandler.java Centralizes feature-loading logic, injects installationId into FeatureDataDTO
DeviceHandler.java Major refactor of command handling and feature update processing; adds hygiene and holiday support
FeatureDataDTO.java Adds toPrettyJson() for anonymized debug output
FeatureProperties.java Adds custom Gson deserializer for flexible/additional properties; adds new fields
FeatureCommand.java + FeatureCommandParams.java + FeatureCommandParamType.java New generic command model
StoredChannelValues.java New class to cache channel values for multi-param command assembly
ThingMessageDTO.java Updated to use Map<String, FeatureCommand>
ViessmannBindingConstants.java Adds new unit map entries and constants
BindingServlet.java Null-safety fix for User-Agent header
ViessmannApi.java Encoding and logging improvements
Various deleted DTO files Removed granular command/parameter DTOs replaced by generic model

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

rogrun and others added 8 commits March 7, 2026 06:44
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
…rams

Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
@rogrun
Copy link
Contributor Author

rogrun commented Mar 8, 2026

@rogrun not sure if i asked before, but it would be appreciated if PR's are kept small, by seperating the bug fixes, refactoring and enhancements. This would make it simpler to review, backport, list changes in the release notes seperate and reduces the possibility of regressions.

@lsiepel Thanks for the reminder. I’ll try to keep future PRs smaller and separate bug fixes, refactorings and enhancements where possible to make reviews and backports easier.

rogrun and others added 3 commits March 8, 2026 20:39
Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, i have just two comments left

rogrun and others added 2 commits March 8, 2026 21:53
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Co-authored-by: lsiepel <leosiepel@gmail.com>
Signed-off-by: Ronny Grun <ronny.grun@t-online.de>
Copy link
Contributor

@lsiepel lsiepel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks LGTM

@lsiepel lsiepel merged commit 1edae95 into openhab:main Mar 8, 2026
2 checks passed
@lsiepel lsiepel added this to the 5.2 milestone Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An enhancement or new feature for an existing add-on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants