[velux] Fixed a couple of bugs if the Bridge contains one or more Scenes (#9794)
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
This commit is contained in:
parent
8616c72ce1
commit
b4705eb75c
Binary file not shown.
|
@ -100,6 +100,9 @@ public class VeluxBindingConstants {
|
|||
THING_TYPE_VELUX_ACTUATOR, THING_TYPE_VELUX_ROLLERSHUTTER, THING_TYPE_VELUX_WINDOW,
|
||||
THING_TYPE_VELUX_VSHUTTER, THING_TYPE_BINDING, THING_TYPE_BRIDGE);
|
||||
|
||||
public static final Set<ThingTypeUID> ACTUATOR_THINGS = Set.of(THING_TYPE_VELUX_ACTUATOR,
|
||||
THING_TYPE_VELUX_ROLLERSHUTTER, THING_TYPE_VELUX_WINDOW);
|
||||
|
||||
// *** List of all Channel ids ***
|
||||
|
||||
// List of all binding channel ids
|
||||
|
@ -153,6 +156,4 @@ public class VeluxBindingConstants {
|
|||
|
||||
public static final String UNKNOWN_THING_TYPE_ID = "FAILED";
|
||||
public static final String UNKNOWN_IP_ADDRESS = "xxx.xxx.xxx.xxx";
|
||||
|
||||
public static final String BRIDGE_THING_TYPE_UID = THING_TYPE_BRIDGE.toString();
|
||||
}
|
||||
|
|
|
@ -313,7 +313,8 @@ public class VeluxDiscoveryService extends AbstractDiscoveryService implements R
|
|||
@Override
|
||||
protected void startBackgroundDiscovery() {
|
||||
logger.trace("startBackgroundDiscovery() called.");
|
||||
if (backgroundTask == null || backgroundTask.isCancelled()) {
|
||||
ScheduledFuture<?> task = this.backgroundTask;
|
||||
if (task == null || task.isCancelled()) {
|
||||
this.backgroundTask = scheduler.scheduleWithFixedDelay(this::startScan, 10, 600, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ final class ChannelBridgeCheck extends ChannelHandlerTemplate {
|
|||
LOGGER.trace("handleCommand(): ignoring non SCENE_ACTION.");
|
||||
continue;
|
||||
}
|
||||
if (!ThingConfiguration.exists(thisBridgeHandler, channelUID,
|
||||
if (!ThingConfiguration.exists(thisBridgeHandler, thisChannelUID,
|
||||
VeluxBindingProperties.PROPERTY_SCENE_NAME)) {
|
||||
LOGGER.trace("handleCommand(): aborting processing as scene name is not set.");
|
||||
break;
|
||||
|
|
|
@ -200,7 +200,7 @@ public class VeluxBridgeHandler extends ExtendedBaseBridgeHandler implements Vel
|
|||
* @param channelUID for type {@link ChannelUID}.
|
||||
* @return thingTypeUID of type {@link ThingTypeUID}.
|
||||
*/
|
||||
ThingTypeUID thingTypeUIDOf(ChannelUID channelUID) {
|
||||
public ThingTypeUID thingTypeUIDOf(ChannelUID channelUID) {
|
||||
String[] segments = channelUID.getAsString().split(AbstractUID.SEPARATOR);
|
||||
if (segments.length > 1) {
|
||||
return new ThingTypeUID(segments[0], segments[1]);
|
||||
|
|
|
@ -52,8 +52,9 @@ public class Thing2VeluxActuator {
|
|||
// Private
|
||||
|
||||
private void mapThing2Velux() {
|
||||
if (channelUID.toString().startsWith(VeluxBindingConstants.BRIDGE_THING_TYPE_UID)) {
|
||||
logger.trace("mapThing2Velux(): channel {} is on a Bridge Thing, exiting.", channelUID);
|
||||
// only process real actuator things
|
||||
if (!VeluxBindingConstants.ACTUATOR_THINGS.contains(bridgeHandler.thingTypeUIDOf(channelUID))) {
|
||||
logger.trace("mapThing2Velux(): channel {} is not an Actuator Thing, exiting.", channelUID);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue