Package org.openhab.core.types

Examples of org.openhab.core.types.State


        EHealthSensorPropertyName propertyName = provider.getSensorPropertyName(itemName);
       
        // do only publish a new state if it has changed ...
        if (datagram.hasChanged(previousDatagram, propertyName)) {
          Number sensorValue = datagram.getRawData().get(propertyName);
          State newState = new DecimalType(sensorValue.toString());
          eventPublisher.postUpdate(itemName, newState);
        }
      }
    }
   
View Full Code Here


        String message = stripByteCount(response);
        if(message != null) {
          if(message.contains("RESULT OK")){

            List<Class<? extends State>> stateTypeList = provider.getAcceptedDataTypes(itemName,command);
            State newState = createStateFromString(stateTypeList,commandAsString);

            if(newState != null) {
              eventPublisher.postUpdate(itemName, newState);                               
            } else {
              logger.warn("Can not parse "+commandAsString+" to match command {} on item {}  ",command,itemName);
View Full Code Here

            if(aCommand==ohCommand) {
              if(providerCommand.matches(theCommand)){

                List<Class<? extends State>> stateTypeList = provider.getAcceptedDataTypes(itemName,aCommand);
                State newState = null;

                if(aCommand instanceof DecimalType) {
                  newState = createStateFromString(stateTypeList,theCommand.remote+","+theCommand.command);
                } else {
                  newState = createStateFromString(stateTypeList,aCommand.toString());
View Full Code Here

    }

    private void processItems(HeatmiserThermostat thermostat) {
      for (HeatmiserBindingProvider provider : providers) {
        for (String itemName : provider.getBindingItemsAtAddress(thermostat.getAddress())) {
          State state = null;
          switch(provider.getFunction(itemName)) {
          case FROSTTEMP:
            state = thermostat.getFrostTemperature(provider.getItemType(itemName));
            break;
          case FLOORTEMP:
View Full Code Here

    // Don't trigger event if this item is bound to another alarm type
    if (alarmType != null && AlarmType.getAlarmType(Integer.parseInt(alarmType)) != alarmEvent.getAlarmType())
      return;
   
    State state = converter.convertFromValueToState(event.getValue());
    this.getEventPublisher().postUpdate(item.getName(), state);
  }
View Full Code Here

    if (converter == null) {
      logger.warn("NODE {}: No converter found for item = {}, endpoint = {}, ignoring event.", event.getNodeId(), item.getName(), event.getEndpoint());
      return;
    }
   
    State state = converter.convertFromValueToState(event.getValue());
    this.getEventPublisher().postUpdate(item.getName(), state);
   
  }
View Full Code Here

  private static <T> void addCommand(T[] cache, int index, T newValue, String commandType,
      Map<AnelCommandType, State> result) {
    if (newValue != null) {
      if (!newValue.equals(cache[index])) {
        final AnelCommandType cmd = AnelCommandType.getCommandType(commandType);
        final State state;
        if (newValue instanceof String) {
          state = new StringType((String) newValue);
        } else if (newValue instanceof Boolean) {
          state = (Boolean) newValue ? OnOffType.ON : OnOffType.OFF;
        } else {
View Full Code Here

               
        logger.trace("adding historic item {}: time {} value {}",
            historicItemName, rawTime, rawValue);
       
        Date time = new Date(rawTime.longValue());
        State value = objectToState(rawValue, historicItemName);
       
        historicItems.add(new InfluxdbItem(historicItemName, value, time));
      }
    }
View Full Code Here

    if (item != null) {
      Device device = deviceMap.get(item.getName());

      if (device != null) {

        State state = null;
        if (item instanceof DimmerItem) {
          state = new PercentType(
              getPercent(device.getMaxOutPutValue(),
                  device.getOutputValue()));
View Full Code Here

      new ProviderItemIterator().iterate(event.getBindingConfig(), new ProviderItemIteratorCallback() {

        @Override
        public void next(HomematicBindingConfig providerBindingConfig, Item item, Converter<?> converter) {
          State state = converter.convertFromBinding(event.getHmValueItem());
          context.getEventPublisher().postUpdate(item.getName(), state);
          if (state == OnOffType.ON) {
            executeBindingAction(providerBindingConfig);
            if (event.isPressValueItem()) {
              itemDisabler.add(providerBindingConfig);
View Full Code Here

TOP

Related Classes of org.openhab.core.types.State

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.