Fix add link "compatible item" logic (#1231)

The checks on which item types are allowed to be linked introduced with
#1106 & #1043 have a serious issue that prevents the items of the actual
type of the channel to be linked individually.

Fixes #1204.
Fixes https://github.com/openhab/openhab-core/issues/2568.

Signed-off-by: Yannick Schaus <github@schaus.net>
pull/1236/head
Yannick Schaus 2021-12-16 22:05:34 +01:00 committed by GitHub
parent c5c912fa3d
commit 0e226cf48b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -239,7 +239,8 @@ export default {
getCompatibleItemTypes () {
let compatibleItemTypes = []
if (this.channel.itemType) {
this.channel.itemType.split(':', 1)
compatibleItemTypes.push(this.channel.itemType)
if (this.channel.itemType.indexOf('Number:') === 0) { compatibleItemTypes.push('Number') }
if (this.channel.itemType === 'Color') { compatibleItemTypes.push('Switch', 'Dimmer') }
if (this.channel.itemType === 'Dimmer') { compatibleItemTypes.push('Switch') }
}