diff --git a/bundles/org.openhab.binding.hdpowerview/README.md b/bundles/org.openhab.binding.hdpowerview/README.md index 85d358fbacee7..d913d53416a82 100644 --- a/bundles/org.openhab.binding.hdpowerview/README.md +++ b/bundles/org.openhab.binding.hdpowerview/README.md @@ -76,8 +76,8 @@ have different `id` values: | Channel Group | Channel | Item Type | Description | |---------------|---------|-----------|-------------| -| scenes | id | Switch | Setting this to ON will activate the scene. Scenes are stateless in the PowerView hub; they have no on/off state. Note: include `{autoupdate="false"}` in the item configuration to avoid having to reset it to off after use. | -| sceneGroups | id | Switch | Setting this to ON will activate the scene group. Scene groups are stateless in the PowerView hub; they have no on/off state. Note: include `{autoupdate="false"}` in the item configuration to avoid having to reset it to off after use. | +| scenes | id | Switch | Setting this to ON will activate the scene. Scenes are stateless in the PowerView hub; they have no on/off state. | +| sceneGroups | id | Switch | Setting this to ON will activate the scene group. Scene groups are stateless in the PowerView hub; they have no on/off state. | | automations | id | Switch | Setting this to ON will enable the automation, while OFF will disable it. | ### Channels for Shades (Thing type `shade`) @@ -239,7 +239,7 @@ Switch Bedroom_Repeater_BlinkingEnabled "Bedroom Repeater Blinking Enabled [%s]" Scene items: ``` -Switch Living_Room_Shades_Scene_Heart "Living Room Shades Scene Heart" (g_Shades_Scene_Trigger) {channel="hdpowerview:hub:g24:scenes#22663", autoupdate="false"} +Switch Living_Room_Shades_Scene_Heart "Living Room Shades Scene Heart" (g_Shades_Scene_Trigger) {channel="hdpowerview:hub:g24:scenes#22663"} ``` ### `demo.sitemap` File diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneChannelBuilder.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneChannelBuilder.java index ad11985cb4cdc..01c05137e9ece 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneChannelBuilder.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneChannelBuilder.java @@ -24,6 +24,7 @@ import org.openhab.core.thing.ChannelGroupUID; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.binding.builder.ChannelBuilder; +import org.openhab.core.thing.type.AutoUpdatePolicy; /** * The {@link SceneChannelBuilder} class creates scene channels @@ -95,6 +96,7 @@ private Channel createChannel(Scene scene) { ChannelUID channelUid = new ChannelUID(channelGroupUid, Integer.toString(scene.id)); String description = translationProvider.getText("dynamic-channel.scene-activate.description", scene.getName()); return ChannelBuilder.create(channelUid, CoreItemFactory.SWITCH).withType(channelTypeUid) - .withLabel(scene.getName()).withDescription(description).build(); + .withLabel(scene.getName()).withDescription(description).withAutoUpdatePolicy(AutoUpdatePolicy.VETO) + .build(); } } diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneGroupChannelBuilder.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneGroupChannelBuilder.java index 2b70b21d2e6a0..4cc4436ea2f32 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneGroupChannelBuilder.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/builders/SceneGroupChannelBuilder.java @@ -24,6 +24,7 @@ import org.openhab.core.thing.ChannelGroupUID; import org.openhab.core.thing.ChannelUID; import org.openhab.core.thing.binding.builder.ChannelBuilder; +import org.openhab.core.thing.type.AutoUpdatePolicy; /** * The {@link SceneGroupChannelBuilder} class creates scene group channels @@ -97,6 +98,7 @@ private Channel createChannel(SceneCollection sceneCollection) { String description = translationProvider.getText("dynamic-channel.scene-group-activate.description", sceneCollection.getName()); return ChannelBuilder.create(channelUid, CoreItemFactory.SWITCH).withType(channelTypeUid) - .withLabel(sceneCollection.getName()).withDescription(description).build(); + .withLabel(sceneCollection.getName()).withDescription(description) + .withAutoUpdatePolicy(AutoUpdatePolicy.VETO).build(); } } diff --git a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/SceneChannelBuilderTest.java b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/SceneChannelBuilderTest.java index 94065aa07f043..80f867423e931 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/SceneChannelBuilderTest.java +++ b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/SceneChannelBuilderTest.java @@ -29,6 +29,7 @@ import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelGroupUID; import org.openhab.core.thing.ThingUID; +import org.openhab.core.thing.type.AutoUpdatePolicy; import org.osgi.framework.Bundle; /** @@ -80,6 +81,15 @@ public void groupAndIdAreCorrect() { assertEquals(Integer.toString(scenes.get(0).id), channels.get(0).getUID().getIdWithoutGroup()); } + @Test + public void autoUpdatePolicyIsCorrect() { + List scenes = createScenes(); + List channels = builder.withScenes(scenes).build(); + + assertEquals(1, channels.size()); + assertEquals(AutoUpdatePolicy.VETO, channels.get(0).getAutoUpdatePolicy()); + } + @Test public void suppliedListIsUsed() { List scenes = createScenes(); diff --git a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/SceneGroupChannelBuilderTest.java b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/SceneGroupChannelBuilderTest.java index 16286650d59fe..f5566e4c5b58b 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/SceneGroupChannelBuilderTest.java +++ b/bundles/org.openhab.binding.hdpowerview/src/test/java/org/openhab/binding/hdpowerview/SceneGroupChannelBuilderTest.java @@ -29,6 +29,7 @@ import org.openhab.core.thing.Channel; import org.openhab.core.thing.ChannelGroupUID; import org.openhab.core.thing.ThingUID; +import org.openhab.core.thing.type.AutoUpdatePolicy; import org.osgi.framework.Bundle; /** @@ -80,6 +81,15 @@ public void groupAndIdAreCorrect() { assertEquals(Integer.toString(sceneCollections.get(0).id), channels.get(0).getUID().getIdWithoutGroup()); } + @Test + public void autoUpdatePolicyIsCorrect() { + List sceneCollections = createSceneCollections(); + List channels = builder.withSceneCollections(sceneCollections).build(); + + assertEquals(1, channels.size()); + assertEquals(AutoUpdatePolicy.VETO, channels.get(0).getAutoUpdatePolicy()); + } + @Test public void suppliedListIsUsed() { List sceneCollections = createSceneCollections();