public static final String NHCON = "On";
public static final String NHCOFF = "Off";
+ public static final String NHCTRUE = "True";
+ public static final String NHCFALSE = "False";
+
public static final String NHCTRIGGERED = "Triggered";
// rollershutter constants in the Nhc layer
*/
package org.openhab.binding.nikohomecontrol.internal.protocol.nhc2;
+import static org.openhab.binding.nikohomecontrol.internal.protocol.NikoHomeControlConstants.*;
+
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.nikohomecontrol.internal.protocol.NhcAction;
public void execute(String command) {
logger.debug("execute action {} of type {} for {}", command, type, id);
- nhcComm.executeAction(id, command);
+ String cmd;
+ if ("flag".equals(model)) {
+ cmd = NHCON.equals(command) ? NHCTRUE : NHCFALSE;
+ } else {
+ cmd = command;
+ }
+
+ nhcComm.executeAction(id, cmd);
}
/**
.orElse(null);
}
- if ("action".equals(device.type)) {
+ if ("action".equals(device.type) || "virtual".equals(device.type)) {
if (!actions.containsKey(device.uuid)) {
logger.debug("adding action device {}, {}", device.uuid, device.name);
case "socket":
case "switched-generic":
case "switched-fan":
+ case "flag":
actionType = ActionType.RELAY;
break;
case "dimmer":
booleanState = basicStateProperty.get().basicState;
}
- if (NHCOFF.equals(booleanState)) {
+ if (NHCOFF.equals(booleanState) || NHCFALSE.equals(booleanState)) {
action.setBooleanState(false);
logger.debug("setting action {} internally to OFF", action.getId());
}
}
}
- if (NHCON.equals(booleanState)) {
+ if (NHCON.equals(booleanState) || NHCTRUE.equals(booleanState)) {
action.setBooleanState(true);
logger.debug("setting action {} internally to ON", action.getId());
}