Open kaikreuzer opened 3 years ago
FTR, I have created https://github.com/openhab/openhab-core/pull/2179 to make the REST API return a 400 instead of a 500 in future.
https://github.com/openhab/openhab-core/pull/2179 has been merged.
@kaikreuzer I just had a look and it seems that this syntax as documented in https://www.openhab.org/docs/configuration/items.html#multi-binding-channel-linkage works correctly:
Dimmer Light_Ceiling "Deckenlicht" <light> { channel="hue:0220:1:20:brightness" [ profile="abc" ], channel="knx:device:ip:knx_1_1_1:3" [ profile="def" ] }
with the added benefit that it allows to set the individual links' config, like different profiles.
I don't seem to find any documented example of the comma-separated channels in a single string value, and was unaware it was supported. Is it still relevant with the consideration above (unable to set a different configuration per link). If so how should an eventual configuration reflected in the (multiple) links in that case, like {channel="channel1,channel2" [ config="value" ]}
- it turns out to be less trivial than expected!
The comma separated syntax was the original one and has been always supported already - and it is imho also much nicer in most cases as it feels slightly weird to have the same key occurring multiple times. Would hence be nice to see it supported in the import as well.
If so how should an eventual configuration reflected in the (multiple) links in that case
The configuration should be applied to all channels in the list. That's how it is processed in the GenericItemChannelLinkProvider
, which parses this part of the DSL files.
The problem
I am trying to use "Add Items from Textual Definition". My item definition has multiple links:
UI shows the message:
Expected behavior
Item and two links are created.
Steps to reproduce
Your environment
Distro build 2182
Browser console
Shows HTTP 500 server error
Browser network traffic
HTTP 500 is returned by the call to
/rest/links/Light_Ceiling/hue%3A0220%1%3A20%3Abrightness%2Cknx%3Adevice%3Aip%3Aknx_1_1_1%3A3
which results in an exception on server side:Additional information
It seems that the UI needs to split the string at every comma and do multiple PUT requests for creating the links.