当前位置: 首页>>代码示例>>Java>>正文


Java OnOffType.OFF属性代码示例

本文整理汇总了Java中org.eclipse.smarthome.core.library.types.OnOffType.OFF属性的典型用法代码示例。如果您正苦于以下问题:Java OnOffType.OFF属性的具体用法?Java OnOffType.OFF怎么用?Java OnOffType.OFF使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.smarthome.core.library.types.OnOffType的用法示例。


在下文中一共展示了OnOffType.OFF属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleCommand

@Override
public void handleCommand(ChannelUID channelUID, Command command) {
    if (channelUID.getId().equals(ALLOW_PIR_SWITCH)) {
        // TODO: handle command

        // Note: if communication with thing fails for some reason,
        // indicate that by setting the status with detail information
        // updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
        // "Could not control device at IP address x.x.x.x");
    } else if (channelUID.getId().equals(PIR_SWITCH)) {
        if ((OnOffType) command == OnOffType.ON) {
            triggerChannel(getThing().getChannel(EVENT_CHANNEL_ID_MOTION).getUID(), EVENT_MOTION_START);
            triggerChannel(getThing().getChannel(EVENT_CHANNEL_ID_MOTION_START).getUID(), EVENT_MOTION_START);
        } else if ((OnOffType) command == OnOffType.OFF) {
            triggerChannel(getThing().getChannel(EVENT_CHANNEL_ID_MOTION).getUID(), EVENT_MOTION_STOP);
            triggerChannel(getThing().getChannel(EVENT_CHANNEL_ID_MOTION_STOP).getUID(), EVENT_MOTION_STOP);
        }
    } else if (channelUID.getId().equals(MQTT_SWITCH)) {

    } else if (channelUID.getId().equals(MOTION)) {

    }
}
 
开发者ID:IncQueryLabs,项目名称:smarthome-cep-demonstrator,代码行数:23,代码来源:SimpleMotionSensorHandler.java

示例2: handleCommand

@Override
public void handleCommand(ChannelUID channelUID, Command command) {
       if (command instanceof RefreshType) {
           switch (channelUID.getId()) {
           case CHANNEL_ONLINE:
           	try {
				State state = networkService.updateDeviceState() ? OnOffType.ON : OnOffType.OFF;
				updateState(CHANNEL_ONLINE, state);					
			} catch( InvalidConfigurationException invalidConfigurationException) {
				getThing().setStatus(ThingStatus.OFFLINE);
			}
           	break;
           default:
               logger.debug("Command received for an unknown channel: {}", channelUID.getId());
               break;
           }
       } else {
           logger.debug("Command {} is not supported for channel: {}", command, channelUID.getId());
       }	
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:20,代码来源:NetworkHandler.java

示例3: getStationState

/**
 * Handles determining a channel's current state from the OpenSprinkler device.
 *
 * @param stationId Int of the station to control. Starts at 0.
 * @return State representation for the channel.
 */
protected State getStationState(int stationId) {
    boolean stationOn = false;

    try {
        stationOn = openSprinklerDevice.isStationOpen(stationId);
    } catch (Exception exp) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
                "Could not get the station channel " + (stationId + 1)
                        + " current state from the OpenSprinkler thing.");
        logger.debug(
                "Could not get current state of station channel {} for the OpenSprinkler device. Exception received: {}",
                (stationId + 1), exp.toString());
    }

    if (stationOn) {
        return OnOffType.ON;
    } else {
        return OnOffType.OFF;
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:26,代码来源:OpenSprinklerHandler.java

示例4: onReceiveCommand

@Override
public void onReceiveCommand(ConnectableDevice device, String channelId, LGWebOSHandler handler, Command command) {
    if (device == null) {
        /*
         * Unable to send anything to a null device. Unless the user configured autoupdate="false" neither
         * onDeviceReady nor onDeviceRemoved will be called and item state would be permanently inconsistent.
         * Therefore setting state to OFF
         */
        handler.postUpdate(channelId, OnOffType.OFF);
        return;
    }

    if (OnOffType.ON == command || OnOffType.OFF == command) {
        if (OnOffType.ON == command && device.hasCapabilities(PowerControl.On)) {
            getControl(device).powerOn(createDefaultResponseListener());
        } else if (OnOffType.OFF == command && device.hasCapabilities(PowerControl.Off)) {
            getControl(device).powerOff(createDefaultResponseListener());
        }
    } else {
        logger.warn("only accept OnOffType");
        return;
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:23,代码来源:PowerControlPower.java

示例5: convertToState

@Override
public State convertToState(String channelId) throws RFXComUnsupportedChannelException {

    switch (channelId) {
        case CHANNEL_COMMAND:
        case CHANNEL_MOTION:
            return command.isOn() ? OnOffType.ON : OnOffType.OFF;

        case CHANNEL_CONTACT:
            return command.isOn() ? OpenClosedType.OPEN : OpenClosedType.CLOSED;

        case CHANNEL_COMMAND_ID:
            return new DecimalType(commandId);

        default:
            return super.convertToState(channelId);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:18,代码来源:RFXComLighting4Message.java

示例6: getSwing

public State getSwing() {
    if (zoneState.getSetting().getType() == TadoSystemType.AIR_CONDITIONING) {
        CoolingZoneSetting setting = (CoolingZoneSetting) zoneState.getSetting();
        if (setting.getSwing() == null) {
            return UnDefType.NULL;
        } else if (setting.getSwing() == Power.ON) {
            return OnOffType.ON;
        } else {
            return OnOffType.OFF;
        }
    } else {
        return UnDefType.UNDEF;
    }
}
 
开发者ID:dfrommi,项目名称:openhab-tado,代码行数:14,代码来源:TadoZoneStateAdapter.java

示例7: commandReceived

@Override
public void commandReceived(ZclCommand command) {
    if (command instanceof ZoneStatusChangeNotificationCommand) {
        ZoneStatusChangeNotificationCommand zoneStatus = (ZoneStatusChangeNotificationCommand) command;
        OnOffType state = ((zoneStatus.getZoneStatus() & 0x01) != 0) ? OnOffType.ON : OnOffType.OFF;
        updateChannelState(state);
    }
}
 
开发者ID:openhab,项目名称:org.openhab.binding.zigbee,代码行数:8,代码来源:ZigBeeConverterIasMotionIntrusion.java

示例8: commandReceived

@Override
public void commandReceived(ZclCommand command) {
    if (command instanceof ZoneStatusChangeNotificationCommand) {
        ZoneStatusChangeNotificationCommand zoneStatus = (ZoneStatusChangeNotificationCommand) command;
        OnOffType state = ((zoneStatus.getZoneStatus() & 0x02) != 0) ? OnOffType.ON : OnOffType.OFF;
        updateChannelState(state);
    }
}
 
开发者ID:openhab,项目名称:org.openhab.binding.zigbee,代码行数:8,代码来源:ZigBeeConverterIasMotionPresence.java

示例9: startAutomaticRefresh

private void startAutomaticRefresh() {
	Runnable runnable = new Runnable() {
		public void run() {
			try {
				State state = networkService.updateDeviceState() ? OnOffType.ON : OnOffType.OFF;
				updateState(CHANNEL_ONLINE, state);					
			} catch( InvalidConfigurationException invalidConfigurationException) {
				getThing().setStatus(ThingStatus.OFFLINE);
			}
		}
	};
	
	refreshJob = scheduler.scheduleAtFixedRate(runnable, 0, networkService.getRefreshInterval(), TimeUnit.MILLISECONDS);
}
 
开发者ID:Neulinet,项目名称:Zoo,代码行数:14,代码来源:NetworkHandler.java

示例10: handleSendEvent

@Override
public void handleSendEvent(Device device, int resendCount, boolean isdimmer, Command command)
        throws TellstickException {

    logger.info("Send {} to {}", command, device);
    if (device instanceof TellstickNetDevice) {
        if (command == OnOffType.ON) {
            turnOn(device);
        } else if (command == OnOffType.OFF) {
            turnOff(device);
        } else if (command instanceof PercentType) {
            dim(device, (PercentType) command);
        } else if (command instanceof IncreaseDecreaseType) {
            increaseDecrease(device, ((IncreaseDecreaseType) command));
        }
    } else if (device instanceof SwitchableDevice) {
        if (command == OnOffType.ON) {
            if (isdimmer) {
                logger.debug("Turn off first in case it is allready on");
                turnOff(device);
            }
            turnOn(device);
        } else if (command == OnOffType.OFF) {
            turnOff(device);
        }
    } else {
        logger.warn("Cannot send to {}", device);
    }

}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:30,代码来源:TelldusLiveDeviceController.java

示例11: convertToState

@Override
public State convertToState(String channelId) throws RFXComUnsupportedChannelException {

    switch (channelId) {
        case CHANNEL_COMMAND:
            switch (command) {
                case OFF:
                case GROUP_OFF:
                    return OnOffType.OFF;

                case ON:
                case GROUP_ON:
                    return OnOffType.ON;

                default:
                    throw new RFXComUnsupportedChannelException("Can't convert " + command + " for " + channelId);
            }

        case CHANNEL_CONTACT:
            switch (command) {
                case OFF:
                case GROUP_OFF:
                    return OpenClosedType.CLOSED;

                case ON:
                case GROUP_ON:
                    return OpenClosedType.OPEN;

                default:
                    throw new RFXComUnsupportedChannelException("Can't convert " + command + " for " + channelId);
            }

        default:
            return super.convertToState(channelId);
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:36,代码来源:RFXComLighting6Message.java

示例12: onReceiveCommand

@Override
public void onReceiveCommand(ConnectableDevice device, String channelId, LGWebOSHandler handler, Command command) {
    if (device == null) {
        return;
    }
    if (OnOffType.ON == command || OnOffType.OFF == command) {
        if (device.hasCapabilities(VolumeControl.Mute_Set)) {
            getControl(device).setMute(OnOffType.ON == command, createDefaultResponseListener());
        }
    } else {
        logger.warn("only accept OnOffType");
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:13,代码来源:VolumeControlMute.java

示例13: sendEvent

private void sendEvent(Device device, int resendCount, boolean isdimmer, Command command)
        throws TellstickException {
    for (int i = 0; i < resendCount; i++) {
        checkLastAndWait(resendInterval);
        logger.debug("Send {} to {} times={}", command, device, i);
        if (device instanceof DimmableDevice) {
            if (command == OnOffType.ON) {
                turnOn(device);
            } else if (command == OnOffType.OFF) {
                turnOff(device);
            } else if (command instanceof PercentType) {
                dim(device, (PercentType) command);
            } else if (command instanceof IncreaseDecreaseType) {
                increaseDecrease(device, ((IncreaseDecreaseType) command));
            }
        } else if (device instanceof SwitchableDevice) {
            if (command == OnOffType.ON) {
                if (isdimmer) {
                    logger.debug("Turn off first in case it is allready on");
                    turnOff(device);
                    checkLastAndWait(resendInterval);
                }
                turnOn(device);
            } else if (command == OnOffType.OFF) {
                turnOff(device);
            }
        } else {
            logger.warn("Cannot send to {}", device);
        }
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:31,代码来源:TelldusCoreDeviceController.java

示例14: perform

@Override
public void perform(AbstractDevice device, Item item, String value) {
    OnOffType cmdValue = OnOffType.OFF;
    if (Objects.equals("1", value)) {
        cmdValue = OnOffType.ON;
    }

    ItemCommandEvent event = ItemEventFactory.createCommandEvent(item.getName(), cmdValue, COMMAND_SOURCE);
    eventPublisher.post(event);
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:10,代码来源:SetStatusAction.java

示例15: isLowBattery

/**
 * Check if battery level is below low battery threshold level.
 *
 * @param batteryLevel Internal battery level
 * @return OnOffType
 */
private State isLowBattery(State batteryLevel) {
    int level = ((DecimalType) batteryLevel).intValue();
    if (level <= LOW_BATTERY_LEVEL) {
        return OnOffType.ON;
    } else {
        return OnOffType.OFF;
    }
}
 
开发者ID:openhab,项目名称:openhab2-addons,代码行数:14,代码来源:RFXComHandler.java


注:本文中的org.eclipse.smarthome.core.library.types.OnOffType.OFF属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。