这是indexloc提供的服务,不要输入任何密码
Skip to content

Thing upgrade gives different result than recreating thing #3569

@jlaur

Description

@jlaur

This is a follow-up to openhab/openhab-docs#2040 (comment).

I have now tested the different update scenarios I could think of:

Channel id Channel type id Channel label Channel type label Channel label localized Channel type label localized Update instruction label After upgrade After recreate
test1 test1 Type 1 Type 1 Type 1
test2 test2 Channel 2 Type 2 Type 2 Channel 2
test3 test3 Channel 3 Type 3 Kanal 3 Type 3 Kanal 3
test4 test4 Channel 4 Type 4 Kanal 4 Art 4 Art 4 Kanal 4
test5 test5 Channel 5 Type 5 Kanal 5 Art 5 Update 5 Update 5 Kanal 5
test6 test6 Type 6 Update 6 Update 6 Type 6
test7 test7 Type 7 Art 7 Update 7 Update 7 Art 7

Retested after #3576 (build 3455), no changes.

Expected Behavior

Thing upgrade should give same result as recreating thing. At least I understand this as one of the motivations for #3330.

I would expect channel label to be considered and take precedence over channel type label.

I would additionally expect I18N localized strings to take precedence over English strings.

If it would work this way, update instruction labels would not be needed as they would be redundant.

All of this should apply to descriptions as well.

Current Behavior

  • Channel item labels are not taken into consideration.
  • Update instruction labels are taken into consideration. This can set a label that can not be set any other way (e.g. by creating a new thing) - why is this useful?
  • Update instruction labels are not localizable.

Currently it's impossible to get it right with I18N. Update instruction label can be copied from channel label, which makes it almost correct, but then restricted to English.

Steps to Reproduce

I added this to a binding for testing:

instructions.xml

		<instruction-set targetVersion="2">
			<add-channel id="test1" groupIds="main">
				<type>danfossairunit:test1</type>
			</add-channel>
			<add-channel id="test2" groupIds="main">
				<type>danfossairunit:test2</type>
			</add-channel>
			<add-channel id="test3" groupIds="main">
				<type>danfossairunit:test3</type>
			</add-channel>
			<add-channel id="test4" groupIds="main">
				<type>danfossairunit:test4</type>
			</add-channel>
			<add-channel id="test5" groupIds="main">
				<type>danfossairunit:test5</type>
				<label>Update 5</label>
			</add-channel>
			<add-channel id="test6" groupIds="main">
				<type>danfossairunit:test6</type>
				<label>Update 6</label>
			</add-channel>
			<add-channel id="test7" groupIds="main">
				<type>danfossairunit:test7</type>
				<label>Update 7</label>
			</add-channel>
		</instruction-set>

thing-types.xml

			<channel id="test1" typeId="test1"/>
			<channel id="test2" typeId="test2">
				<label>Channel 2</label>
			</channel>
			<channel id="test3" typeId="test3">
				<label>Channel 3</label>
			</channel>
			<channel id="test4" typeId="test4">
				<label>Channel 4</label>
			</channel>
			<channel id="test5" typeId="test5">
				<label>Channel 5</label>
			</channel>
			<channel id="test6" typeId="test6"/>
			<channel id="test7" typeId="test7"/>

	<channel-type id="test1">
		<item-type>String</item-type>
		<label>Type 1</label>
	</channel-type>
	<channel-type id="test2">
		<item-type>String</item-type>
		<label>Type 2</label>
	</channel-type>
	<channel-type id="test3">
		<item-type>String</item-type>
		<label>Type 3</label>
	</channel-type>
	<channel-type id="test4">
		<item-type>String</item-type>
		<label>Type 4</label>
	</channel-type>
	<channel-type id="test5">
		<item-type>String</item-type>
		<label>Type 5</label>
	</channel-type>
	<channel-type id="test6">
		<item-type>String</item-type>
		<label>Type 6</label>
	</channel-type>
	<channel-type id="test7">
		<item-type>String</item-type>
		<label>Type 7</label>
	</channel-type>

da.properties

channel-group-type.danfossairunit.main.channel.test3.label = Kanal 3
channel-group-type.danfossairunit.main.channel.test4.label = Kanal 4
channel-group-type.danfossairunit.main.channel.test5.label = Kanal 5

channel-type.danfossairunit.test4.label = Art 4
channel-type.danfossairunit.test5.label = Art 5
channel-type.danfossairunit.test7.label = Art 7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn unexpected problem or unintended behavior of the Core

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions