Skip to content

Comments

[sagercaster] Simplify Thing configuration#19574

Merged
lsiepel merged 4 commits intoopenhab:mainfrom
clinique:sagercaster
Oct 31, 2025
Merged

[sagercaster] Simplify Thing configuration#19574
lsiepel merged 4 commits intoopenhab:mainfrom
clinique:sagercaster

Conversation

@clinique
Copy link
Contributor

This removes the 'observation-period' configuration element.
Adaptations to Java 21 and OH5
Solves #19564

Adapt to Java 21 and OH5

Signed-off-by: gael@lhopital.org <gael@lhopital.org>
Signed-off-by: gael@lhopital.org <gael@lhopital.org>
@lsiepel lsiepel requested a review from Copilot October 28, 2025 21:02
@lsiepel lsiepel added the enhancement An enhancement or new feature for an existing add-on label Oct 28, 2025
@lsiepel lsiepel self-requested a review October 28, 2025 21:03
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 SagerCaster binding to improve code quality and modernization. It adds a new reliability channel that indicates the algorithm's confidence based on historical data accumulation, removes the configurable observation period (now fixed at 6 hours), and modernizes the codebase with Java pattern matching, records, and switch expressions.

Key changes:

  • Adds a new "reliability" channel that shows algorithm confidence as historical data accumulates (0-100%)
  • Removes the observation-period configuration parameter, fixing the observation window at 6 hours
  • Refactors code using modern Java features (pattern matching, switch expressions, records)

Reviewed Changes

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

Show a summary per file
File Description
instructions.xml Adds update instructions for the new reliability channel migration
thing-types.xml Adds thingTypeVersion property, reliability channel definition, and removes observation-period parameter
sagercaster.properties Adds labels/descriptions for the reliability channel
SagerCasterHandler.java Refactors to use modern Java patterns, implements reliability calculation, removes observation-period config
ExpiringMap.java Refactors to use fixed window duration, returns Optional on put(), adds age tracking method
SagerCasterDiscoveryService.java Modernizes with pattern matching instanceof and formatted strings
SagerWeatherCaster.java Converts to use switch expressions and nullable returns instead of UNDEF constant
SagerPrediction.java Converts from class to record with nullable getWindDirection2()
SagerCasterHandlerFactory.java Updates imports to use wildcard and adds final modifiers
SagerCasterBindingConstants.java Changes THING_TYPE_SAGERCASTER initialization and adds SUPPORTED_THING_TYPES_UIDS
README.md Updates documentation to reflect removal of observation-period and addition of reliability channel

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

Signed-off-by: gael@lhopital.org <gael@lhopital.org>
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.

Just one comment, otherwise LGTM

Signed-off-by: gael@lhopital.org <gael@lhopital.org>
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 21f3a7e into openhab:main Oct 31, 2025
2 checks passed
@lsiepel lsiepel added this to the 5.1 milestone Oct 31, 2025
@clinique clinique deleted the sagercaster branch November 4, 2025 15:29
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.

2 participants