Hi,
In the Z-Way Binding the channels are added dynamically. Some Z-Way devices have multiple functions of the same type, for example a rgb bulb has a function for cold white and one for soft white. The channel type is the same for both “switchColorTemperature”. When both channels added dynamically an error occurred: Duplicate channels ...
. For that reason I added a unique identifier to the channel types during the dynamic addition, for example:
...:switchColorTemperature-ZWayVDev_zway_21-0-51-0
...:switchColorTemperature-ZWayVDev_zway_21-0-51-1
That works as expected, when simple mode of item linking is activated.
Problem:
When the simple mode is deactivated and the user try to link the channel manually via PaperUI an error occurred: ChannelType is undefined
(see also topic: Z-Way Binding not working (Channels from Things cannot be used)).
I think the reason is that the REST API for channel types doesn’t provide the modified channel types, only the static defined.
Any ideas? Can I add the channels differently?
Code of dynamic addition:
-
id
is channel id of static defined channel type (XML) -
"-" + properties.get("deviceId")
is the unique identifierThingBuilder thingBuilder = editThing(); ChannelTypeUID channelTypeUID = new ChannelTypeUID(BINDING_ID, id); Channel channel = ChannelBuilder .create(new ChannelUID(getThing().getUID(), id + "-" + properties.get("deviceId")), acceptedItemType) .withType(channelTypeUID).withLabel(label).withProperties(properties).build(); thingBuilder.withChannel(channel); thingBuilder.withLabel(thing.getLabel()); updateThing(thingBuilder.build());