Examples of OnOffType


Examples of org.openhab.core.library.types.OnOffType

        if (needsUpdate) {
          boolean refreshOnlyWhenPowerOn = provider.refreshOnlyWhenPowerOn(itemName);
          String deviceId = provider.getDeviceId(itemName);
         
          if (refreshOnlyWhenPowerOn) {
            OnOffType state = (OnOffType) queryDataFromDevice(
              deviceId, EpsonProjectorCommandType.POWER, SwitchItem.class);
           
             if (state != OnOffType.ON) {
              logger.debug("projector power is OFF, skip refresh for item '{}'", itemName);
              lastUpdateMap.put(itemName, System.currentTimeMillis());
View Full Code Here

Examples of org.openhab.core.library.types.OnOffType

  private void receivedFHTState(String device, String state) {
    logger.debug("Received state " + state + " for FHT device " + device);
    int stateValue = Integer.parseInt(state, 16);
    FHTBindingConfig config = getConfig(device, Datapoint.BATTERY);
    OnOffType batteryAlarm = null;
    if (stateValue % 2 == 0) {
      batteryAlarm = OnOffType.OFF;
    } else {
      stateValue = stateValue - 1;
      batteryAlarm = OnOffType.ON;
View Full Code Here

Examples of org.openhab.core.library.types.OnOffType

          if (ps != curPs) {
            logger.debug("Play state of '{}' changed", playerId);
            playerStatusCache.put(playerId, ps);
           
            PlayerCommandTypeMapping reportTo;
            OnOffType reportStatus;
            // trigger song update
            if (ps.equals(PlayerStatus.STATUS_PAUSED) || ps.equals(PlayerStatus.STATUS_STOPPED)) {
              // stopped 
              reportTo = PlayerCommandTypeMapping.STOP;
              reportStatus = OnOffType.OFF;
View Full Code Here

Examples of org.openhab.core.library.types.OnOffType

   * update items on call end
   * @param config
   */
  private void endCallItemUpdate(FreeswitchBindingConfig config){
   
    OnOffType activeState =  OnOffType.OFF;;
    CallType callType = (CallType)CallType.EMPTY;
    StringType callerId = StringType.EMPTY;

    /*
     * A channel has ended that has this item associated with it
View Full Code Here

Examples of org.openhab.core.library.types.OnOffType

    // the code being executed when a command was sent on the openHAB
    // event bus goes here. This method is only called if one of the
    // BindingProviders provide a binding for the given 'itemName'.
   
    if (command instanceof OnOffType) { 
      final OnOffType switchCommand = (OnOffType) command;
      final OpenSprinklerBindingProvider bindingProvider = findFirstMatchingBindingProvider(itemName, command);
      final int station = bindingProvider.getStationNumber(itemName);
     
      if (station < 0 || station >= numberOfStations) {
        logger.warn("Station " + station + " is not in the valid [" + 0 + ".." + numberOfStations + "] range");
View Full Code Here

Examples of org.openhab.core.library.types.OnOffType

        String current = theMessage.getNamedValue(config.NamedParameter);
     
        Item item = provider.getItem(itemName);
        if (item != null) {
          if (item instanceof SwitchItem) {
             OnOffType status = ( current.equalsIgnoreCase("on") || current.equalsIgnoreCase("true") ||
                         current.equalsIgnoreCase("1"|| current.equalsIgnoreCase("open") ||
                         current.equalsIgnoreCase("high")) ? OnOffType.ON : OnOffType.OFF;
             synchronized (item) {
             if (!item.getState().equals(status)) {
               eventPublisher.postUpdate(itemName, status);
View Full Code Here

Examples of org.openhab.core.library.types.OnOffType

     * @param event
     */
    private void handleHangupCall(String itemName, Class<? extends Item> itemType, HangupEvent event) {
      eventCache.remove(event.getUniqueId());
      if (itemType.isAssignableFrom(SwitchItem.class)) {
        OnOffType activeState =
          (eventCache.size() == 0 ? OnOffType.OFF : OnOffType.ON);
        eventPublisher.postUpdate(itemName, activeState);
      }
      else if (itemType.isAssignableFrom(CallItem.class)) {
        CallType call = (CallType)
View Full Code Here

Examples of org.openhab.core.library.types.OnOffType

      final String device = provider.getNeoStatDevice(itemName);
      switch (provider.getNeoStatProperty(itemName)) {
      case Away:
        if (command instanceof OnOffType) {
          OnOffType onOffType = (OnOffType) command;
          createProtocol().setAway(OnOffType.ON == onOffType, device);
        }
        break;
      case Standby:
        if (command instanceof OnOffType) {
          OnOffType onOffType = (OnOffType) command;
          createProtocol().setStandby(OnOffType.ON == onOffType,
              device);
        }
      default:
        break;
View Full Code Here

Examples of org.openhab.core.library.types.OnOffType

          MBaseDevice mDevice = tinkerforgeEcosystem.getDevice(deviceUid, deviceSubId);
          if (mDevice != null && mDevice.getEnabledA().get()) {
            if (command instanceof OnOffType) {
              logger.trace("{} found onoff command", LoggerConstants.COMMAND);
              if (mDevice instanceof MInSwitchActor) {
                OnOffType cmd = (OnOffType) command;
                OnOffValue state = cmd == OnOffType.OFF ? OnOffValue.OFF : OnOffValue.ON;
                ((MSwitchActor) mDevice).turnSwitch(state);
              } else if (mDevice instanceof DigitalActor) {
                OnOffType cmd = (OnOffType) command;
                HighLowValue state = cmd == OnOffType.OFF ? HighLowValue.LOW : HighLowValue.HIGH;
                ((DigitalActor) mDevice).turnDigital(state);
              } else {
                logger.error("{} received OnOff command for non-SwitchActor",
                    LoggerConstants.COMMAND);
View Full Code Here

Examples of org.openhab.core.library.types.OnOffType

      logger.warn("sending commands is disabled, enable it in openhab.cfg!");
      return;
    }
    String param = "INVALID";
    if (command instanceof OnOffType) {
      OnOffType cmd = (OnOffType) command;
      param = cmd.equals(OnOffType.ON) ? "ON" : "OFF";
    } else if (command instanceof DecimalType) {
      param = ((DecimalType) command).toString();
    } else {
      logger.error("item {} only accepts DecimalType and OnOffType", itemName);
      return;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.