Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[basicprofiles] StateFilterProfile uses linked Item system unit #18144

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

andrewfg
Copy link
Contributor

@andrewfg andrewfg commented Jan 20, 2025

Resolves #18122
Requires openhab/openhab-core#4561
Depends on #18089
Depends on #18127

Previously the calculations over a StateFilterProfile set of time series state values were based on either a) the Unit of the first member in the set or b) the Unit of the incoming new value. There are two problems: a) the order of the set is not fixed, and b) the Unit of the first member Item resp, the incoming new value, is not definitive to the Unit of the expected result. Therefore these calculations could produce variable and unexpected results.

This PR normalises the calculations so that they are all based on the Unit of the target Item to which the StateFilterProfile is linked.

Furthermore this PR allows conversion between non- inverted and inverted Units so invertible conversions (e.g. Kelvin <=> Mirek) are supported.

This PR may have merge conflicts (and possibly functional conflicts) with #18089 and #18127 so let us wait until those PRs are merged first.

Signed-off-by: Andrew Fiddian-Green [email protected]

@andrewfg andrewfg added the enhancement An enhancement or new feature for an existing add-on label Jan 20, 2025
@andrewfg andrewfg self-assigned this Jan 20, 2025
@andrewfg andrewfg requested a review from J-N-K as a code owner January 20, 2025 18:33
@andrewfg andrewfg marked this pull request as draft January 20, 2025 18:33
Signed-off-by: Andrew Fiddian-Green <[email protected]>
@andrewfg
Copy link
Contributor Author

@jimtng @mherwege for info..

@andrewfg andrewfg changed the title [basicprofiles] Improve StateFilterProfile unit based calculations [basicprofiles] Normalise StateFilterProfile calculations to use the linked Item's Unit Jan 21, 2025
@andrewfg andrewfg changed the title [basicprofiles] Normalise StateFilterProfile calculations to use the linked Item's Unit [basicprofiles] Normalise StateFilterProfile calculations to use linked Item's Unit Jan 21, 2025
Signed-off-by: Andrew Fiddian-Green <[email protected]>
Signed-off-by: Andrew Fiddian-Green <[email protected]>
Signed-off-by: Andrew Fiddian-Green <[email protected]>
@andrewfg andrewfg added the awaiting other PR Depends on another PR label Jan 23, 2025
@andrewfg andrewfg requested a review from jimtng January 23, 2025 18:38
@andrewfg andrewfg marked this pull request as ready for review January 23, 2025 18:38
Signed-off-by: Andrew Fiddian-Green <[email protected]>
@andrewfg andrewfg changed the title [basicprofiles] Normalise StateFilterProfile calculations to use linked Item's Unit [basicprofiles] StateFilterProfile calculations use linked Item's Unit Jan 23, 2025
@andrewfg andrewfg changed the title [basicprofiles] StateFilterProfile calculations use linked Item's Unit [basicprofiles] StateFilterProfile calculations use linked Item SystemUnit Jan 23, 2025
Signed-off-by: Andrew Fiddian-Green <[email protected]>
Signed-off-by: Andrew Fiddian-Green <[email protected]>
Signed-off-by: Andrew Fiddian-Green <[email protected]>
@andrewfg andrewfg changed the title [basicprofiles] StateFilterProfile calculations use linked Item SystemUnit [basicprofiles] StateFilterProfile use linked Item SystemUnit Jan 24, 2025
@andrewfg andrewfg changed the title [basicprofiles] StateFilterProfile use linked Item SystemUnit [basicprofiles] StateFilterProfile uses linked Item SystemUnit Jan 24, 2025
Signed-off-by: Andrew Fiddian-Green <[email protected]>
@andrewfg andrewfg changed the title [basicprofiles] StateFilterProfile uses linked Item SystemUnit [basicprofiles] StateFilterProfile uses linked Item system unit Jan 27, 2025
@andrewfg andrewfg added bug An unexpected problem or unintended behavior of an add-on and removed enhancement An enhancement or new feature for an existing add-on labels Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting other PR Depends on another PR bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[basicprofiles] potential problem in calculations over series of QuantityType
1 participant