Examples of FritzahaSwitchedOutlet


Examples of org.openhab.binding.fritzaha.internal.hardware.interfaces.FritzahaSwitchedOutlet

        String currentHostId = currentDevice.getHost();
        if (!hostCache.containsKey(currentHostId))
          continue;
        FritzahaWebInterface currentHost = hostCache.get(currentHostId).getConnection();
        if (currentDevice instanceof FritzahaSwitchedOutlet) {
          FritzahaSwitchedOutlet currentSwitch = (FritzahaSwitchedOutlet) currentDevice;
          currentSwitch.updateSwitchState(currentItem, currentHost);
        } else if (currentDevice instanceof FritzahaOutletMeter) {
          FritzahaOutletMeter currentMeter = (FritzahaOutletMeter) currentDevice;
          currentMeter.updateMeterValue(currentItem, currentHost);
        }
      }
View Full Code Here

Examples of org.openhab.binding.fritzaha.internal.hardware.interfaces.FritzahaSwitchedOutlet

   */
  @Override
  protected void internalReceiveCommand(String itemName, Command command) {
    logger.debug("internalReceiveCommand() is called!");
    FritzahaBindingProvider commandProvider = null;
    FritzahaSwitchedOutlet switchDevice = null;
    for (FritzahaBindingProvider currentProvider : providers) {
      if (!currentProvider.getItemNames().contains(itemName))
        continue;
      FritzahaDevice device = currentProvider.getDeviceConfig(itemName);
      if (!(device instanceof FritzahaSwitchedOutlet))
        continue;
      switchDevice = (FritzahaSwitchedOutlet) device;
      commandProvider = currentProvider;
      break;
    }
    if (commandProvider == null || switchDevice == null) {
      logger.error("No provider found for item " + itemName);
      return;
    }
    if (command instanceof OnOffType) {
      String deviceHostID = switchDevice.getHost();
      Host host = hostCache.get(deviceHostID);
      if(host!=null) {
        FritzahaWebInterface deviceHost = host.getConnection();
        boolean valueToSet = (command == OnOffType.ON);
        switchDevice.setSwitchState(valueToSet, itemName, deviceHost);
      }
    } else {
      logger.debug("Unsupported command type for item " + itemName);
    }
  }
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.