Changing of channels state and options on build, how? [message #1752569] |
Wed, 25 January 2017 08:44  |
Eclipse User |
|
|
|
hi,
I have a question about the creating/modifying of channels in OH2.
I get from the device a kind of channels. This channels have capabilities like min/max for float or only usable string options.
In ESH this states min/max and options are set in the channels xml file but I cannot use it. This limitations are dynamic and known only after the initialisation of the bridge. How can I modify a channel and add state limits (min/max and options) after the thing is created or in thing/channel creation time?
https://www.eclipse.org/smarthome/documentation/development/bindings/thing-definition.html#state-description
Markus
[Updated on: Wed, 25 January 2017 18:56] by Moderator Report message to a moderator
|
|
|
Re: Changing of channels state and options on build, how? [message #1753348 is a reply to message #1752569] |
Sat, 04 February 2017 10:01   |
Eclipse User |
|
|
|
Good question.
The min and max option are currently declared on the channel type and so can't be changed by the channel instance.
You could create a custom channel type (programmatically) all the time you needs other min and max, but I don't think this is the best option.
@kaikreuzer If the min / max is not defined by the type but by a special channel instance, should this channel use a configuration option so a custom UI could react on or should we provide a solution by the framework?
|
|
|
Re: Changing of channels state and options on build, how? [message #1754122 is a reply to message #1753348] |
Tue, 14 February 2017 15:56  |
Eclipse User |
|
|
|
This information is indeed on the channel type only. It is retrieved by the ChannelStateDescriptionProvider in getStateDescription(). We could think about introducing a new interface, which bindings could implement, that would then be asked for specific channel information; a bit similar to the ConfigOptionProvider that we put in place for individual config options.
|
|
|
Powered by
FUDForum. Page generated in 0.07050 seconds