Open obones opened 3 months ago
I see your use-case. I think there never was a discussion about filtering StateProfile
s by ChannelTypeUID
. I would vote for adding that.
Can you prepare a pull request?
This issue has been mentioned on openHAB Community. There might be relevant details there:
I have submitted PR #4325, I hope it's fine as I could not find any related unit tests.
When writing an addon that provides a transformation profile one will most likely use
ProfileTypeBuilder
to get an instance ofProfileType
to be returned by theProfileTypeProvider.getProfileTypes
implementation.This is can be done with code like this:
With the code above, the transformation profile is usable for any item and any channel, which may not be desirable and so one may want to call
withSupportedChannelTypeUIDs
to limit the transformation profile to a given channel type.Expected Behavior
When
withSupportedChannelTypeUIDs
has been called onProfileTypeBuilder
, the created transformation profile should only appear on item links that are between any item and a channel only of the given type UID.Current Behavior
Sadly, the profile above is shown for links on any channel, there are no filtering done. This is because
ProfileTypeBuilder.newState
sets up a callback that ignoresleSupportedChannelTypeUIDs
at this linePossible Solution
I would suggest changing
StateProfileTypeImpl
to acceptsupportedChannelTypeUIDs
in its constructor and overridegetSupportedChannelTypeUIDs
just likeTriggerProfileTypeImpl
does. Note that this would only fix the current issue, but I believe bothStateProfileTypeImpl
andTriggerProfileTypeImpl
should override the three possible filtering sources, not two each like now.Steps to Reproduce (for Bugs)
ProfileTypeProvider
serviceProfileTypeBuilder.newState
alongsidewithSupportedChannelTypeUIDs
Context
I'm currently trying to offer transformation profiles for Air Quality Indicator channels in my OpenMeteo binding and would like them to be limited to channels they apply to.
Your Environment