Package org.openhab.binding.heatmiser.internal.thermostat

Examples of org.openhab.binding.heatmiser.internal.thermostat.HeatmiserThermostat


      pollIterator = null;
      return;
    }

    int pollAddress = (int) pollIterator.next();
    HeatmiserThermostat pollThermostat = new HeatmiserThermostat();
    logger.debug("HEATMISER: polling {}", pollAddress);
    pollThermostat.setAddress((byte)pollAddress);

    if(pollIterator.hasNext() == false)
      pollIterator = null;

    connector.sendMessage(pollThermostat.pollThermostat());
  }
View Full Code Here


  private class MessageListener implements HeatmiserEventListener {
    HeatmiserThermostat thermostatPacket = null;

    @Override
    public void packetReceived(EventObject event, byte[] packet) {
      thermostatPacket = new HeatmiserThermostat();
      if(thermostatPacket.setData(packet) == false)
        return;

      for (HeatmiserThermostat thermostat: thermostatTable) {
        if(thermostat.getAddress() == thermostatPacket.getAddress()) {
          // Found the thermostat
          thermostat.setData(packet);
          processItems(thermostat);
          return;
       
      }
     
      // Thermostat not found in the list of known devices
      // Create a new thermostat and add it to the array
      HeatmiserThermostat newThermostat = null;
      switch(thermostatPacket.getModel()) {
        case PRT:
        case PRTE:
          newThermostat = new HeatmiserPRT();
          break;
        case PRTHW:
          newThermostat = new HeatmiserPRTHW();
          break;
        default:
          logger.error("Unknown heatmiser thermostat type {} at address {}", thermostatPacket.getModel(), thermostatPacket.getAddress());
          break;
      }
     
      // Add the new thermostat to the list
      if(newThermostat != null) {
        newThermostat.setData(packet);
        thermostatTable.add(newThermostat);
        processItems(newThermostat);
      }
    }
View Full Code Here

TOP

Related Classes of org.openhab.binding.heatmiser.internal.thermostat.HeatmiserThermostat

Copyright © 2018 www.massapicom. 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.