-
Notifications
You must be signed in to change notification settings - Fork 781
[core] Added implementation of a ChannelGroupUID #6103
[core] Added implementation of a ChannelGroupUID #6103
Conversation
Signed-off-by: Christoph Weitkamp <[email protected]>
Signed-off-by: Christoph Weitkamp <[email protected]>
Hi @cweitkamp can you please add some more context on what plans you have for a ChannelGroupBuilder? Right now there is now separate entity |
Yes, of course. Currently there is no easy way to create all channels for a specific I am not sure if we need a real builder for it or if we even need a
|
@htreu Since I already posted an initial code snippet I have created some working code too. |
Thanks for the example. This looks pretty good and straight forward. |
I am with you. Unused code is just a millstone around the neck. But of course I have a use case for it. The OWM binding (#5694) supports different forecast strategies (hourly / daily). Currently I decided to use a fixed number of hours (24) / days (5) to be requested whereas the OWM API is capable of delivering more data (max. 5 days / hour forecast and 16 days / daily forecast). Instead of defining fixed numbers I want to add configuration parameter for them. This should make it possible for everyone to adopt the number of forecasted hours / days for their own needs. To archive my goal it would be nice to have an easy way to create a dynamical number of channel groups. |
Yes, I just started to review the OWM binding and realised your needs in this. Thanks for the explanations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although this is already merged, please allow me two comments that I think should be addressed.
public class ChannelGroupUID extends UID { | ||
|
||
private static final String CHANNEL_GROUP_SEGMENT_PATTERN = "[\\w-]*#"; | ||
private static final String CHANNEL_GROUP_SEPERATOR = "#"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: This should be SEPARATOR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hehe, that is a little copy&paste error from ChannelUID
😉. I will change it.
@Test | ||
public void testChannelGroupUID() { | ||
ChannelGroupUID channelGroupUID = new ChannelGroupUID(THING_UID, GROUP_ID); | ||
assertEquals("binding:thing-type:thing:group#", channelGroupUID.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not in line with what the ChannelGroupTypeUID
expects as a channelGroupUid
(String) parameter - the separator should NOT be part of the UID (that anyhow looks a bit weird to me).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I prepare a follow up to remove the #
at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #6157
Initial idea and for discussion.
As preparation for a
ChannelGroupBuilder
which is accessible from theThingHandlerCallback
similar to thecreateChannelBuilder()
oreditChannel()
methods I would like to introduce aChannelGroupUID
to identify the channel group to be created / edited.ChannelGroupUID
Signed-off-by:Christoph Weitkamp [email protected]