[hdpowerview] Add semantic tags (#18510)
* [hdpowerview] Add tags Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>pull/18565/head^2
parent
80c0f6c908
commit
1591c8771c
|
@ -54,11 +54,13 @@ import org.openhab.core.library.types.QuantityType;
|
|||
import org.openhab.core.library.types.StopMoveType;
|
||||
import org.openhab.core.library.types.UpDownType;
|
||||
import org.openhab.core.library.unit.Units;
|
||||
import org.openhab.core.semantics.model.DefaultSemanticTags.Equipment;
|
||||
import org.openhab.core.thing.Channel;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
import org.openhab.core.thing.ThingStatusDetail;
|
||||
import org.openhab.core.thing.binding.builder.ThingBuilder;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
import org.openhab.core.types.UnDefType;
|
||||
|
@ -485,8 +487,16 @@ public class ShadeHandler extends BeaconBluetoothHandler {
|
|||
removeChannels.add(channel);
|
||||
}
|
||||
}
|
||||
if (!removeChannels.isEmpty()) {
|
||||
updateThing(editThing().withoutChannels(removeChannels).build());
|
||||
boolean isDrape = ShadeCapabilitiesDatabase.DRAPES_TYPES.contains(dataReader.getTypeId());
|
||||
if (!removeChannels.isEmpty() || isDrape) {
|
||||
ThingBuilder thingBuilder = editThing();
|
||||
if (!removeChannels.isEmpty()) {
|
||||
thingBuilder = thingBuilder.withoutChannels(removeChannels);
|
||||
}
|
||||
if (isDrape) {
|
||||
thingBuilder = thingBuilder.withSemanticEquipmentTag(Equipment.DRAPES);
|
||||
}
|
||||
updateThing(thingBuilder.build());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ package org.openhab.binding.hdpowerview.internal.database;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -41,6 +42,8 @@ import org.slf4j.LoggerFactory;
|
|||
@NonNullByDefault
|
||||
public class ShadeCapabilitiesDatabase {
|
||||
|
||||
public static final Set<Integer> DRAPES_TYPES = Set.of(69, 70, 71);
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(ShadeCapabilitiesDatabase.class);
|
||||
|
||||
/*
|
||||
|
|
|
@ -51,6 +51,7 @@ import org.openhab.core.library.types.StopMoveType;
|
|||
import org.openhab.core.library.types.StringType;
|
||||
import org.openhab.core.library.types.UpDownType;
|
||||
import org.openhab.core.library.unit.Units;
|
||||
import org.openhab.core.semantics.model.DefaultSemanticTags.Equipment;
|
||||
import org.openhab.core.thing.Bridge;
|
||||
import org.openhab.core.thing.Channel;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
|
@ -276,6 +277,10 @@ public class HDPowerViewShadeHandler extends AbstractHubbedThingHandler {
|
|||
this.capabilities = capabilities;
|
||||
|
||||
updateDynamicChannels(capabilities, shade);
|
||||
|
||||
if (ShadeCapabilitiesDatabase.DRAPES_TYPES.contains(shade.type)) {
|
||||
updateThing(editThing().withSemanticEquipmentTag(Equipment.DRAPES).build());
|
||||
}
|
||||
}
|
||||
|
||||
private Capabilities getCapabilitiesOrDefault() {
|
||||
|
|
|
@ -37,6 +37,7 @@ import org.openhab.core.library.types.PercentType;
|
|||
import org.openhab.core.library.types.StopMoveType;
|
||||
import org.openhab.core.library.types.StringType;
|
||||
import org.openhab.core.library.types.UpDownType;
|
||||
import org.openhab.core.semantics.model.DefaultSemanticTags.Equipment;
|
||||
import org.openhab.core.thing.Bridge;
|
||||
import org.openhab.core.thing.Channel;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
|
@ -224,6 +225,9 @@ public class ShadeThingHandler extends BaseThingHandler {
|
|||
updateCapabilities(shade);
|
||||
updateProperties(shade);
|
||||
updateDynamicChannels(shade);
|
||||
if (shade.getType() instanceof Integer type && ShadeCapabilitiesDatabase.DRAPES_TYPES.contains(type)) {
|
||||
updateThing(editThing().withSemanticEquipmentTag(Equipment.DRAPES).build());
|
||||
}
|
||||
isInitialized = true;
|
||||
}
|
||||
updateChannels(shade);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<bridge-type id="hub">
|
||||
<label>PowerView Hub</label>
|
||||
<description>Hunter Douglas (Luxaflex) PowerView Hub</description>
|
||||
<semantic-equipment-tag>NetworkAppliance</semantic-equipment-tag>
|
||||
|
||||
<channel-groups>
|
||||
<channel-group id="scenes" typeId="scenes"/>
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
<label>Position</label>
|
||||
<description>The vertical position of the shade</description>
|
||||
<category>Blinds</category>
|
||||
<tags>
|
||||
<tag>Control</tag>
|
||||
<tag>OpenLevel</tag>
|
||||
</tags>
|
||||
<state min="0" max="100" pattern="%.1f %%"/>
|
||||
</channel-type>
|
||||
|
||||
|
@ -16,6 +20,10 @@
|
|||
<item-type>Dimmer</item-type>
|
||||
<label>Vane</label>
|
||||
<description>The opening of the slats in the shade</description>
|
||||
<tags>
|
||||
<tag>Control</tag>
|
||||
<tag>Tilt</tag>
|
||||
</tags>
|
||||
<state min="0" max="100" pattern="%.1f %%"/>
|
||||
</channel-type>
|
||||
|
||||
|
@ -57,6 +65,10 @@
|
|||
<channel-type id="automation-enabled">
|
||||
<item-type>Switch</item-type>
|
||||
<label>Enable</label>
|
||||
<tags>
|
||||
<tag>Switch</tag>
|
||||
<tag>Enabled</tag>
|
||||
</tags>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="battery-voltage" advanced="true">
|
||||
|
@ -71,6 +83,10 @@
|
|||
<label>RSSI</label>
|
||||
<description>Received Signal Strength Indicator</description>
|
||||
<category>QualityOfService</category>
|
||||
<tags>
|
||||
<tag>Measurement</tag>
|
||||
<tag>RSSI</tag>
|
||||
</tags>
|
||||
<state readOnly="true" pattern="%d %unit%"></state>
|
||||
</channel-type>
|
||||
|
||||
|
@ -96,6 +112,10 @@
|
|||
<label>Signal Strength</label>
|
||||
<description>Signal strength of Bluetooth Low Energy communication</description>
|
||||
<category>QualityOfService</category>
|
||||
<tags>
|
||||
<tag>Measurement</tag>
|
||||
<tag>RSSI</tag>
|
||||
</tags>
|
||||
<state readOnly="true" pattern="%.0f dBm"/>
|
||||
</channel-type>
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
</supported-bridge-type-refs>
|
||||
<label>PowerView Repeater</label>
|
||||
<description>Hunter Douglas (Luxaflex) PowerView Repeater</description>
|
||||
<semantic-equipment-tag>NetworkAppliance</semantic-equipment-tag>
|
||||
|
||||
<channels>
|
||||
<channel id="color" typeId="system.color">
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
</supported-bridge-type-refs>
|
||||
<label>PowerView Shade</label>
|
||||
<description>Hunter Douglas (Luxaflex) PowerView Gen 1/2 Shade</description>
|
||||
<semantic-equipment-tag>Blinds</semantic-equipment-tag>
|
||||
|
||||
<channels>
|
||||
<channel id="position" typeId="shade-position"/>
|
||||
|
@ -49,6 +50,7 @@
|
|||
</supported-bridge-type-refs>
|
||||
<label>PowerView Shade</label>
|
||||
<description>Hunter Douglas (Luxaflex) PowerView Gen3 Shade</description>
|
||||
<semantic-equipment-tag>Blinds</semantic-equipment-tag>
|
||||
|
||||
<channels>
|
||||
<channel id="position" typeId="shade-position"/>
|
||||
|
|
Loading…
Reference in New Issue