use of org.openhab.core.library.types.UpDownType in project openhab1-addons by openhab.
the class SappBinding method executeSappCommand.
/**
* executes the real command on pnmas device
*/
private void executeSappCommand(String itemName, Command command) {
SappBindingProvider provider = findFirstMatchingBindingProvider(itemName);
if (provider == null) {
logger.error("cannot find a provider, skipping command");
}
try {
Item item = itemRegistry.getItem(itemName);
logger.debug("found item {}", item);
if (item instanceof SwitchItem && !(item instanceof DimmerItem)) {
SappBindingConfigSwitchItem sappBindingConfigSwitchItem = (SappBindingConfigSwitchItem) provider.getBindingConfig(itemName);
logger.debug("found binding {}", sappBindingConfigSwitchItem);
if (sappBindingConfigSwitchItem.isPollerSuspender()) {
if (pollingEnabled) {
// turning off polling
pollingEnabled = false;
// force updates of polling switches because polling is
updatePollingSwitchesState(provider);
// off
} else {
// turning on polling
provider.getSappUpdatePendingRequests().replaceAllPendingUpdateRequests(ALL_UPDATE_REQUEST_KEY);
pollingEnabled = true;
}
} else {
SappAddressOnOffControl controlAddress = sappBindingConfigSwitchItem.getControl();
if (!provider.getPnmasMap().containsKey(controlAddress.getPnmasId())) {
logger.error("bad pnmas id ({}) in binding ({}) ... skipping", controlAddress.getPnmasId(), sappBindingConfigSwitchItem);
return;
}
try {
if (command instanceof OnOffType) {
switch(controlAddress.getAddressType()) {
case VIRTUAL:
{
// mask bits on previous value
int previousValue = getVirtualValue(provider, controlAddress.getPnmasId(), controlAddress.getAddress(), controlAddress.getSubAddress(), false);
int newValue = SappBindingConfigUtils.maskWithSubAddressAndSet(controlAddress.getSubAddress(), command.equals(OnOffType.ON) ? controlAddress.getOnValue() : controlAddress.getOffValue(), previousValue);
// update pnmas
SappPnmas pnmas = provider.getPnmasMap().get(controlAddress.getPnmasId());
SappCentralExecuter sappCentralExecuter = SappCentralExecuter.getInstance();
sappCentralExecuter.executeSapp7DCommand(pnmas.getIp(), pnmas.getPort(), controlAddress.getAddress(), newValue);
break;
}
default:
logger.error("cannot run {} on type {}", command.getClass().getSimpleName(), controlAddress.getAddressType());
break;
}
} else {
logger.error("command {} not applicable", command.getClass().getSimpleName());
}
} catch (SappException e) {
logger.error("could not run sappcommand", e);
}
}
} else if (item instanceof NumberItem) {
SappBindingConfigNumberItem sappBindingConfigNumberItem = (SappBindingConfigNumberItem) provider.getBindingConfig(itemName);
logger.debug("found binding {}", sappBindingConfigNumberItem);
SappAddressDecimal address = sappBindingConfigNumberItem.getStatus();
if (!provider.getPnmasMap().containsKey(address.getPnmasId())) {
logger.error("bad pnmas id ({}) in binding ({}) ... skipping", address.getPnmasId(), sappBindingConfigNumberItem);
return;
}
try {
if (command instanceof DecimalType) {
switch(address.getAddressType()) {
case VIRTUAL:
{
// mask bits on previous value
int previousValue = getVirtualValue(provider, address.getPnmasId(), address.getAddress(), address.getSubAddress(), false);
int newValue = SappBindingConfigUtils.maskWithSubAddressAndSet(address.getSubAddress(), address.backScaledValue(((DecimalType) command).toBigDecimal()), previousValue);
// update pnmas
SappPnmas pnmas = provider.getPnmasMap().get(address.getPnmasId());
SappCentralExecuter sappCentralExecuter = SappCentralExecuter.getInstance();
sappCentralExecuter.executeSapp7DCommand(pnmas.getIp(), pnmas.getPort(), address.getAddress(), newValue);
break;
}
default:
logger.error("cannot run {} on type {}", command.getClass().getSimpleName(), address.getAddressType());
break;
}
} else {
logger.error("command {} not applicable", command.getClass().getSimpleName());
}
} catch (SappException e) {
logger.error("could not run sappcommand", e);
}
} else if (item instanceof RollershutterItem) {
SappBindingConfigRollershutterItem sappBindingConfigRollershutterItem = (SappBindingConfigRollershutterItem) provider.getBindingConfig(itemName);
logger.debug("found binding {}", sappBindingConfigRollershutterItem);
SappAddressRollershutterControl controlAddress = null;
if (command instanceof UpDownType && ((UpDownType) command) == UpDownType.UP) {
controlAddress = sappBindingConfigRollershutterItem.getUpControl();
} else if (command instanceof UpDownType && ((UpDownType) command) == UpDownType.DOWN) {
controlAddress = sappBindingConfigRollershutterItem.getDownControl();
} else if (command instanceof StopMoveType && ((StopMoveType) command) == StopMoveType.STOP) {
controlAddress = sappBindingConfigRollershutterItem.getStopControl();
}
if (controlAddress != null) {
if (!provider.getPnmasMap().containsKey(controlAddress.getPnmasId())) {
logger.error("bad pnmas id ({}) in binding ({}) ... skipping", controlAddress.getPnmasId(), sappBindingConfigRollershutterItem);
return;
}
try {
switch(controlAddress.getAddressType()) {
case VIRTUAL:
{
// mask bits on previous value
int previousValue = getVirtualValue(provider, controlAddress.getPnmasId(), controlAddress.getAddress(), controlAddress.getSubAddress(), false);
int newValue = SappBindingConfigUtils.maskWithSubAddressAndSet(controlAddress.getSubAddress(), controlAddress.getActivateValue(), previousValue);
// update pnmas
SappPnmas pnmas = provider.getPnmasMap().get(controlAddress.getPnmasId());
SappCentralExecuter sappCentralExecuter = SappCentralExecuter.getInstance();
sappCentralExecuter.executeSapp7DCommand(pnmas.getIp(), pnmas.getPort(), controlAddress.getAddress(), newValue);
break;
}
default:
logger.error("cannot run {} on type {}", command.getClass().getSimpleName(), controlAddress.getAddressType());
break;
}
} catch (SappException e) {
logger.error("could not run sappcommand", e);
}
} else {
logger.error("command {} not applicable", command.getClass().getSimpleName());
}
} else if (item instanceof DimmerItem) {
SappBindingConfigDimmerItem sappBindingConfigDimmerItem = (SappBindingConfigDimmerItem) provider.getBindingConfig(itemName);
logger.debug("found binding {}", sappBindingConfigDimmerItem);
SappAddressDimmer address = sappBindingConfigDimmerItem.getStatus();
if (!provider.getPnmasMap().containsKey(address.getPnmasId())) {
logger.error("bad pnmas id ({}) in binding ({}) ... skipping", address.getPnmasId(), sappBindingConfigDimmerItem);
return;
}
try {
if (command instanceof OnOffType) {
switch(address.getAddressType()) {
case VIRTUAL:
{
// mask bits on previous value
int previousValue = getVirtualValue(provider, address.getPnmasId(), address.getAddress(), address.getSubAddress(), false);
int newValue = SappBindingConfigUtils.maskWithSubAddressAndSet(address.getSubAddress(), ((OnOffType) command) == OnOffType.ON ? address.getOriginalMaxScale() : address.getOriginalMinScale(), previousValue);
// update pnmas
SappPnmas pnmas = provider.getPnmasMap().get(address.getPnmasId());
SappCentralExecuter sappCentralExecuter = SappCentralExecuter.getInstance();
sappCentralExecuter.executeSapp7DCommand(pnmas.getIp(), pnmas.getPort(), address.getAddress(), newValue);
break;
}
default:
logger.error("cannot run {} on type {}", command.getClass().getSimpleName(), address.getAddressType());
break;
}
} else if (command instanceof IncreaseDecreaseType) {
switch(address.getAddressType()) {
case VIRTUAL:
{
// mask bits on previous value
int previousValue = getVirtualValue(provider, address.getPnmasId(), address.getAddress(), address.getSubAddress(), false);
int newValue = SappBindingConfigUtils.maskWithSubAddressAndSet(address.getSubAddress(), ((IncreaseDecreaseType) command) == IncreaseDecreaseType.INCREASE ? Math.min(previousValue + address.getIncrement(), address.getOriginalMaxScale()) : Math.max(previousValue - address.getIncrement(), address.getOriginalMinScale()), previousValue);
// update pnmas
SappPnmas pnmas = provider.getPnmasMap().get(address.getPnmasId());
SappCentralExecuter sappCentralExecuter = SappCentralExecuter.getInstance();
sappCentralExecuter.executeSapp7DCommand(pnmas.getIp(), pnmas.getPort(), address.getAddress(), newValue);
break;
}
default:
logger.error("cannot run {} on type {}", command.getClass().getSimpleName(), address.getAddressType());
break;
}
} else if (command instanceof PercentType) {
switch(address.getAddressType()) {
case VIRTUAL:
{
// mask bits on previous value
int previousValue = getVirtualValue(provider, address.getPnmasId(), address.getAddress(), address.getSubAddress(), false);
int newValue = SappBindingConfigUtils.maskWithSubAddressAndSet(address.getSubAddress(), address.backScaledValue(((PercentType) command).toBigDecimal()), previousValue);
// update pnmas
SappPnmas pnmas = provider.getPnmasMap().get(address.getPnmasId());
SappCentralExecuter sappCentralExecuter = SappCentralExecuter.getInstance();
sappCentralExecuter.executeSapp7DCommand(pnmas.getIp(), pnmas.getPort(), address.getAddress(), newValue);
break;
}
default:
logger.error("cannot run {} on type {}", command.getClass().getSimpleName(), address.getAddressType());
break;
}
} else {
logger.error("command {} not applicable", command.getClass().getSimpleName());
}
} catch (SappException e) {
logger.error("could not run sappcommand", e);
}
} else {
logger.error("unimplemented item type: {}", item.getClass().getSimpleName());
}
} catch (ItemNotFoundException e) {
logger.error("Item {} not found", itemName);
}
}
use of org.openhab.core.library.types.UpDownType in project openhab1-addons by openhab.
the class ItemStateRequestProcessor method getState.
private StateTransformable getState(Item item) {
StateTransformable state = null;
if (item.getState() instanceof HSBType) {
HSBType hsb = (HSBType) item.getState();
state = new HSBData(hsb.getHue().longValue(), hsb.getHue().longValue(), hsb.getHue().longValue());
} else if (item.getState() instanceof DateTimeType) {
DateTimeType dt = (DateTimeType) item.getState();
DateTimeDataType data = new DateTimeDataType(dt.toString());
state = new DateTimeData(data);
} else if (item.getState() instanceof DecimalType) {
} else if (item.getState() instanceof OnOffType) {
} else if (item.getState() instanceof OpenClosedType) {
} else if (item.getState() instanceof PercentType) {
} else if (item.getState() instanceof UpDownType) {
}
return state;
}
use of org.openhab.core.library.types.UpDownType in project openhab1-addons by openhab.
the class MochadX10Binding method internalReceiveCommand.
@Override
protected void internalReceiveCommand(String itemName, Command command) {
MochadX10BindingConfig deviceConfig = getConfigForItemName(itemName);
if (deviceConfig == null) {
return;
}
String address = deviceConfig.getAddress();
String tm = deviceConfig.getTransmitMethod();
String commandStr = "none";
Command previousCommand = lastIssuedCommand.get(address);
int level = -1;
if (command instanceof OnOffType) {
commandStr = OnOffType.ON.equals(command) ? "on" : "off";
level = OnOffType.ON.equals(command) ? 100 : 0;
} else if (command instanceof UpDownType) {
commandStr = UpDownType.UP.equals(command) ? "bright" : "dim";
level = UpDownType.UP.equals(command) ? 100 : 0;
} else if (command instanceof StopMoveType) {
if (StopMoveType.STOP.equals(command)) {
commandStr = UpDownType.UP.equals(previousCommand) ? "dim" : "bright";
} else {
// Move not supported yet
commandStr = "none";
}
} else if (command instanceof PercentType) {
if (deviceConfig.getItemType() == DimmerItem.class) {
level = ((PercentType) command).intValue();
if (((PercentType) command).intValue() == 0) {
// If percent value equals 0 the x10 "off" command is used instead of the dim command
commandStr = "off";
} else {
long dim_value = 0;
if (deviceConfig.getDimMethod().equals("xdim")) {
// 100% maps to value (XDIM_LEVELS - 1) so we need to do scaling
dim_value = Math.round(((PercentType) command).doubleValue() * (MochadX10Command.XDIM_LEVELS - 1) / 100);
commandStr = "xdim " + dim_value;
} else {
// 100% maps to value (DIM_LEVELS - 1) so we need to do scaling
Integer currentValue = currentLevel.get(address);
if (currentValue == null) {
currentValue = 0;
}
logger.debug("Address " + address + " current level " + currentValue);
int newValue = ((PercentType) command).intValue();
int relativeValue;
if (newValue > currentValue) {
relativeValue = (int) Math.round((newValue - currentValue) * ((MochadX10Command.DIM_LEVELS - 1) * 1.0 / 100));
commandStr = "bright " + relativeValue;
} else if (currentValue > newValue) {
relativeValue = (int) Math.round((currentValue - newValue) * ((MochadX10Command.DIM_LEVELS - 1) * 1.0 / 100));
commandStr = "dim " + relativeValue;
} else {
// If there is no change in state, do nothing
commandStr = "none";
}
}
}
} else if (deviceConfig.getItemType() == RollershutterItem.class) {
level = ((PercentType) command).intValue();
Double invert_level = 100 - ((PercentType) command).doubleValue();
long newlevel = Math.round(invert_level * 25.0 / 100);
commandStr = "extended_code_1 0 1 " + newlevel;
}
} else if (command instanceof IncreaseDecreaseType) {
// Increase decrease not yet supported
commandStr = "none";
}
try {
if (!commandStr.equals("none")) {
out.writeBytes(tm + " " + address + " " + commandStr + "\n");
logger.debug(tm + " " + address + " " + commandStr);
out.flush();
previousX10Address.setAddress(address);
logger.debug("Previous X10 address set to " + previousX10Address.toString());
if (level != -1) {
currentLevel.put(address, level);
logger.debug("Address " + address + " level set to " + level);
}
}
} catch (IOException e) {
reconnectToMochadX10Server();
logger.error("IOException: " + e.getMessage() + " while trying to send a command to Mochad X10 host: " + hostIp + ":" + hostPort);
}
lastIssuedCommand.put(address, command);
}
use of org.openhab.core.library.types.UpDownType in project openhab1-addons by openhab.
the class IhcDataConverter method convertCommandToResourceValue.
/**
* Convert openHAB data type to IHC data type.
*
* @param type
* openHAB data type
* @param value
*
* @param enumValues
*
* @return IHC data type
*/
public static WSResourceValue convertCommandToResourceValue(Type type, WSResourceValue value, ArrayList<IhcEnumValue> enumValues) {
if (type instanceof DecimalType) {
if (value instanceof WSFloatingPointValue) {
double newVal = ((DecimalType) type).doubleValue();
double max = ((WSFloatingPointValue) value).getMaximumValue();
double min = ((WSFloatingPointValue) value).getMinimumValue();
if (newVal >= min && newVal <= max) {
((WSFloatingPointValue) value).setFloatingPointValue(newVal);
} else {
throw new NumberFormatException("Value is not between accetable limits (min=" + min + ", max=" + max + ")");
}
} else if (value instanceof WSBooleanValue) {
((WSBooleanValue) value).setValue(((DecimalType) type).intValue() > 0 ? true : false);
} else if (value instanceof WSIntegerValue) {
int newVal = ((DecimalType) type).intValue();
int max = ((WSIntegerValue) value).getMaximumValue();
int min = ((WSIntegerValue) value).getMinimumValue();
if (newVal >= min && newVal <= max) {
((WSIntegerValue) value).setInteger(newVal);
} else {
throw new NumberFormatException("Value is not between accetable limits (min=" + min + ", max=" + max + ")");
}
} else if (value instanceof WSTimerValue) {
((WSTimerValue) value).setMilliseconds(((DecimalType) type).longValue());
} else if (value instanceof WSWeekdayValue) {
((WSWeekdayValue) value).setWeekdayNumber(((DecimalType) type).intValue());
} else {
throw new NumberFormatException("Can't convert DecimalType to " + value.getClass());
}
} else if (type instanceof OnOffType) {
if (value instanceof WSBooleanValue) {
((WSBooleanValue) value).setValue(type == OnOffType.ON ? true : false);
} else if (value instanceof WSIntegerValue) {
int newVal = type == OnOffType.ON ? 100 : 0;
int max = ((WSIntegerValue) value).getMaximumValue();
int min = ((WSIntegerValue) value).getMinimumValue();
if (newVal >= min && newVal <= max) {
((WSIntegerValue) value).setInteger(newVal);
} else {
throw new NumberFormatException("Value is not between accetable limits (min=" + min + ", max=" + max + ")");
}
} else {
throw new NumberFormatException("Can't convert OnOffType to " + value.getClass());
}
} else if (type instanceof OpenClosedType) {
((WSBooleanValue) value).setValue(type == OpenClosedType.OPEN ? true : false);
} else if (type instanceof DateTimeType) {
if (value instanceof WSDateValue) {
Calendar c = ((DateTimeType) type).getCalendar();
short year = (short) c.get(Calendar.YEAR);
byte month = (byte) (c.get(Calendar.MONTH) + 1);
byte day = (byte) c.get(Calendar.DAY_OF_MONTH);
((WSDateValue) value).setYear(year);
((WSDateValue) value).setMonth(month);
((WSDateValue) value).setDay(day);
} else if (value instanceof WSTimeValue) {
Calendar c = ((DateTimeType) type).getCalendar();
int hours = c.get(Calendar.HOUR_OF_DAY);
int minutes = c.get(Calendar.MINUTE);
int seconds = c.get(Calendar.SECOND);
((WSTimeValue) value).setHours(hours);
((WSTimeValue) value).setMinutes(minutes);
((WSTimeValue) value).setSeconds(seconds);
} else {
throw new NumberFormatException("Can't convert DateTimeItem to " + value.getClass());
}
} else if (type instanceof StringType) {
if (value instanceof WSEnumValue) {
boolean found = false;
for (IhcEnumValue item : enumValues) {
if (item.name.equals(type.toString())) {
((WSEnumValue) value).setEnumValueID(item.id);
((WSEnumValue) value).setEnumName(type.toString());
found = true;
break;
}
}
if (found == false) {
throw new NumberFormatException("Can't find enum value for string " + type.toString());
}
} else {
throw new NumberFormatException("Can't convert StringType to " + value.getClass());
}
} else if (type instanceof PercentType) {
if (value instanceof WSIntegerValue) {
int newVal = ((DecimalType) type).intValue();
int max = ((WSIntegerValue) value).getMaximumValue();
int min = ((WSIntegerValue) value).getMinimumValue();
if (newVal >= min && newVal <= max) {
((WSIntegerValue) value).setInteger(newVal);
} else {
throw new NumberFormatException("Value is not between accetable limits (min=" + min + ", max=" + max + ")");
}
} else {
throw new NumberFormatException("Can't convert PercentType to " + value.getClass());
}
} else if (type instanceof UpDownType) {
if (value instanceof WSBooleanValue) {
((WSBooleanValue) value).setValue(type == UpDownType.DOWN ? true : false);
} else if (value instanceof WSIntegerValue) {
int newVal = type == UpDownType.DOWN ? 100 : 0;
int max = ((WSIntegerValue) value).getMaximumValue();
int min = ((WSIntegerValue) value).getMinimumValue();
if (newVal >= min && newVal <= max) {
((WSIntegerValue) value).setInteger(newVal);
} else {
throw new NumberFormatException("Value is not between accetable limits (min=" + min + ", max=" + max + ")");
}
} else {
throw new NumberFormatException("Can't convert UpDownType to " + value.getClass());
}
} else {
throw new NumberFormatException("Can't convert " + type.getClass().toString());
}
return value;
}
use of org.openhab.core.library.types.UpDownType in project openhab1-addons by openhab.
the class TinkerforgeBinding method internalReceiveCommand.
/**
* {@inheritDoc}
*
* Searches the item with the given {@code itemName} in the {@link TinkerforgeBindingProvider}
* collection and gets the uid and subid of the device. The appropriate device is searched in the
* ecosystem and the command is executed on the device.
*
* {@code OnOffType} commands are executed on {@link MInSwitchActor} objects. {@code StringType}
* commands are executed on {@link MTextActor} objects.
*
*/
@Override
protected void internalReceiveCommand(String itemName, Command command) {
logger.debug("received command {} for item {}", command, itemName);
for (TinkerforgeBindingProvider provider : providers) {
for (String itemNameP : provider.getItemNames()) {
if (itemNameP.equals(itemName)) {
String deviceUid = provider.getUid(itemName);
String deviceSubId = provider.getSubId(itemName);
String deviceName = provider.getName(itemName);
if (deviceName != null) {
String[] ids = getDeviceIdsForDeviceName(deviceName);
deviceUid = ids[0];
deviceSubId = ids[1];
}
logger.trace("{} found item for command: uid: {}, subid: {}", LoggerConstants.COMMAND, deviceUid, deviceSubId);
MBaseDevice mDevice = tinkerforgeEcosystem.getDevice(deviceUid, deviceSubId);
if (mDevice != null && mDevice.getEnabledA().get()) {
if (command instanceof OnOffType) {
logger.trace("{} found onoff command", LoggerConstants.COMMAND);
OnOffType cmd = (OnOffType) command;
if (mDevice instanceof MSwitchActor) {
OnOffValue state = cmd == OnOffType.OFF ? OnOffValue.OFF : OnOffValue.ON;
((MSwitchActor) mDevice).turnSwitch(state);
} else if (mDevice instanceof DigitalActor) {
HighLowValue state = cmd == OnOffType.OFF ? HighLowValue.LOW : HighLowValue.HIGH;
((DigitalActor) mDevice).turnDigital(state);
} else if (mDevice instanceof ProgrammableSwitchActor) {
OnOffValue state = cmd == OnOffType.OFF ? OnOffValue.OFF : OnOffValue.ON;
((ProgrammableSwitchActor) mDevice).turnSwitch(state, provider.getDeviceOptions(itemName));
} else {
logger.error("{} received OnOff command for non-SwitchActor", LoggerConstants.COMMAND);
}
} else if (command instanceof StringType) {
logger.trace("{} found string command", LoggerConstants.COMMAND);
if (mDevice instanceof MTextActor) {
((MTextActor) mDevice).write(command.toString());
}
} else if (command instanceof DecimalType) {
logger.debug("{} found number command", LoggerConstants.COMMAND);
if (command instanceof HSBType) {
logger.debug("{} found HSBType command", LoggerConstants.COMMAND);
if (mDevice instanceof ProgrammableColorActor) {
logger.debug("{} found ProgrammableColorActor {}", itemName);
((ProgrammableColorActor) mDevice).setSelectedColor((HSBType) command, provider.getDeviceOptions(itemName));
} else if (mDevice instanceof SimpleColorActor) {
logger.debug("{} found SimpleColorActor {}", itemName);
((SimpleColorActor) mDevice).setSelectedColor((HSBType) command);
}
} else if (command instanceof PercentType) {
if (mDevice instanceof SetPointActor) {
((SetPointActor<?>) mDevice).setValue(((PercentType) command), provider.getDeviceOptions(itemName));
logger.debug("found SetpointActor");
} else if (mDevice instanceof PercentTypeActor) {
((PercentTypeActor) mDevice).setValue(((PercentType) command), provider.getDeviceOptions(itemName));
logger.debug("found PercentType actor");
} else {
logger.error("found no percenttype actor");
}
} else {
if (mDevice instanceof NumberActor) {
((NumberActor) mDevice).setNumber(((DecimalType) command).toBigDecimal());
} else if (mDevice instanceof SetPointActor) {
((SetPointActor<?>) mDevice).setValue(((DecimalType) command).toBigDecimal(), provider.getDeviceOptions(itemName));
} else {
logger.error("found no number actor");
}
}
} else if (command instanceof UpDownType) {
UpDownType cmd = (UpDownType) command;
logger.debug("{} UpDownType command {}", itemName, cmd);
if (mDevice instanceof MoveActor) {
((MoveActor) mDevice).move((UpDownType) command, provider.getDeviceOptions(itemName));
}
} else if (command instanceof StopMoveType) {
StopMoveType cmd = (StopMoveType) command;
if (mDevice instanceof MoveActor) {
if (cmd == StopMoveType.STOP) {
((MoveActor) mDevice).stop();
} else {
((MoveActor) mDevice).moveon(provider.getDeviceOptions(itemName));
}
}
logger.debug("{} StopMoveType command {}", itemName, cmd);
} else if (command instanceof IncreaseDecreaseType) {
IncreaseDecreaseType cmd = (IncreaseDecreaseType) command;
if (mDevice instanceof DimmableActor) {
((DimmableActor<?>) mDevice).dimm((IncreaseDecreaseType) command, provider.getDeviceOptions(itemName));
}
logger.debug("{} IncreaseDecreaseType command {}", itemName, cmd);
} else {
logger.error("{} got unknown command type: {}", LoggerConstants.COMMAND, command.toString());
}
} else {
logger.error("{} no tinkerforge device found for command for item uid: {} subId: {}", LoggerConstants.COMMAND, deviceUid, deviceSubId);
}
}
}
}
}
Aggregations