Examples of PlugwiseCommandType


Examples of org.openhab.binding.plugwise.PlugwiseCommandType

          plugwiseID = statusMatcher.group(1);
          plugwiseCommand = statusMatcher.group(2);
          interval = Integer.valueOf(statusMatcher.group(3));
        }

        PlugwiseCommandType type = PlugwiseCommandType.getCommandType(plugwiseCommand)

        if(PlugwiseCommandType.validateBinding(type, item)) {

          PlugwiseBindingConfigElement newElement = new PlugwiseBindingConfigElement(plugwiseID,type,interval);
View Full Code Here

Examples of org.openhab.binding.plugwise.PlugwiseCommandType

      }

      for(Command someCommand : commands) {

        String plugwiseID = provider.getPlugwiseID(itemName,someCommand);
        PlugwiseCommandType plugwiseCommandType = provider.getPlugwiseCommandType(itemName,someCommand);

        if(plugwiseID != null) {
          if(plugwiseCommandType != null){
            @SuppressWarnings("unused")
            boolean result = executeCommand(plugwiseID,plugwiseCommandType,commandAsString);
View Full Code Here

Examples of org.openhab.binding.plugwise.PlugwiseCommandType

        List<PlugwiseBindingConfigElement> compiledList = ((PlugwiseBindingProvider)provider).getIntervalList();

        Iterator<PlugwiseBindingConfigElement> pbcIterator = compiledList.iterator();
        while(pbcIterator.hasNext()) {
          PlugwiseBindingConfigElement anElement = pbcIterator.next();
          PlugwiseCommandType type = anElement.getCommandType();

          // check if the device already exists (via cfg definition of Role Call)

          if(stick.getDevice(anElement.getId())==null) {
            logger.debug("The Plugwise device with id {} is not yet defined",anElement.getId());

            // check if the config string really contains a MAC address
            Pattern MAC_PATTERN = Pattern.compile("(\\w{16})");
            Matcher matcher = MAC_PATTERN.matcher(anElement.getId());
            if(matcher.matches()){
              CirclePlus cp = (CirclePlus) stick.getDeviceByName("circleplus");
              if(cp!=null) {
                if(!cp.getMAC().equals(anElement.getId())) {
                  //a circleplus has been added/detected and it is not what is in the binding config
                  PlugwiseDevice device = new Circle(anElement.getId(),stick,anElement.getId());
                  stick.plugwiseDeviceCache.add(device)
                  logger.info("Plugwise added Circle with MAC address: {}",anElement.getId());
                }
              } else {
                logger.warn("Plugwise can not guess the device that should be added. Consider defining it in the openHAB configuration file");
              }
            } else {
              logger.warn("Plugwise can not add a valid device without a proper MAC address. {} can not be used",anElement.getId());
            }
          }

          if(stick.getDevice(anElement.getId())!=null) {

            boolean jobExists = false;

            // enumerate each job group
            try {
              for(String group: sched.getJobGroupNames()) {
                // enumerate each job in group
                for(JobKey jobKey : sched.getJobKeys(jobGroupEquals(group))) {
                  if(jobKey.getName().equals(anElement.getId()+"-"+type.getJobClass().toString())) {
                    jobExists = true;
                    break;
                  }
                }
              }
            } catch (SchedulerException e1) {
              logger.error("An exception occurred while quering the Quartz Scheduler ({})",e1.getMessage());
            }

            if(!jobExists) {
              // set up the Quartz jobs
              JobDataMap map = new JobDataMap();
              map.put("Stick", stick);
              map.put("MAC",stick.getDevice(anElement.getId()).MAC);

              JobDetail job = newJob(type.getJobClass())
                  .withIdentity(anElement.getId()+"-"+type.getJobClass().toString(), "Plugwise-"+provider.toString())
                  .usingJobData(map)
                  .build();

              Trigger trigger = newTrigger()
                  .withIdentity(anElement.getId()+"-"+type.getJobClass().toString(), "Plugwise-"+provider.toString())
                  .startNow()
                  .withSchedule(simpleSchedule()
                      .repeatForever()
                      .withIntervalInSeconds(anElement.getInterval()))           
                      .build();
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.