Package org.openhab.core.items

Examples of org.openhab.core.items.Item


    DSCAlarmItemType dscAlarmItemType = null;
    APICode apiCode = APICode.getAPICodeValue(apiMessage.getAPICode());
    String apiData = apiMessage.getAPIData();
    DSCAlarmBindingConfig config = null;
    Item item = null;
    String itemName = "";
    int forLimit = 1;

    boolean found = false;
   
View Full Code Here


    SimpleDateFormat mysqlDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    // Get the item name from the filter
    // Also get the Item object so we can determine the type
    Item item = null;
    String itemName = filter.getItemName();
    logger.debug("mySQL query: item is {}", itemName);
    try {
      if (itemRegistry != null) {
        item = itemRegistry.getItem(itemName);
View Full Code Here

  static public void sendCommand(String itemName, String commandString) {
    ItemRegistry registry = (ItemRegistry) RulesActivator.itemRegistryTracker.getService();
    EventPublisher publisher = (EventPublisher) RulesActivator.eventPublisherTracker.getService();
    if(publisher!=null && registry!=null) {
      try {
        Item item = registry.getItem(itemName);
        Command command = TypeParser.parseCommand(item.getAcceptedCommandTypes(), commandString);
        publisher.sendCommand(itemName, command);
      } catch (ItemNotFoundException e) {
        logger.warn("Item '" + itemName + "' does not exist.");
      }
    }
View Full Code Here

  static public void postUpdate(String itemName, String stateString) {
    ItemRegistry registry = (ItemRegistry) RulesActivator.itemRegistryTracker.getService();
    EventPublisher publisher = (EventPublisher) RulesActivator.eventPublisherTracker.getService();
    if(publisher!=null && registry!=null) {
      try {
        Item item = registry.getItem(itemName);
        State state = TypeParser.parseState(item.getAcceptedDataTypes(), stateString);
        publisher.postUpdate(itemName, state);
      } catch (ItemNotFoundException e) {
        logger.warn("Item '" + itemName + "' does not exist.");
      }
    }
View Full Code Here

   * after startup or an item reload.
   *
   * @see BindingChangedDelayedExecutor
   */
  private void informCommunicator(HomematicBindingProvider hmProvider, String itemName) {
    final Item item = hmProvider.getItem(itemName);
    final HomematicBindingConfig bindingConfig = hmProvider.getBindingFor(itemName);
    if (bindingConfig != null) {
      delayedExecutor.cancel();
      delayedExecutor.addBindingConfig(item, bindingConfig);
      delayedExecutor.schedule(new TimerTask() {
View Full Code Here

   * Receives a command and send it to the Homematic communicator.
   */
  @Override
  protected void internalReceiveCommand(String itemName, Command command) {
    for (HomematicBindingProvider provider : providers) {
      Item item = provider.getItem(itemName);
      HomematicBindingConfig config = provider.getBindingFor(itemName);
      communicator.receiveCommand(item, command, config);
    }
  }
View Full Code Here

   * Receives a state and send it to the Homematic communicator.
   */
  @Override
  protected void internalReceiveUpdate(String itemName, State newState) {
    for (HomematicBindingProvider provider : providers) {
      Item item = provider.getItem(itemName);
      HomematicBindingConfig config = provider.getBindingFor(itemName);
      communicator.receiveUpdate(item, newState, config);
    }
  }
View Full Code Here

   * @param itemName the name of the item that will receive the event.
   * @param event the received {@link ZWaveCommandClassValueEvent}.
   */
   public void handleEvent(ZWaveBindingProvider provider, String itemName, ZWaveCommandClassValueEvent event) {
    ZWaveBindingConfig bindingConfiguration = provider.getZwaveBindingConfig(itemName);
    Item item = provider.getItem(itemName);
    String commandClassName = bindingConfiguration.getArguments().get("command");
    boolean respondToBasic = "true".equalsIgnoreCase(bindingConfiguration.getArguments().get("respond_to_basic"));

    logger.trace("Getting converter for item = {}, command class = {}, item command class = {}", itemName, event.getCommandClass().getLabel(), commandClassName);
   
View Full Code Here

        XplBindingConfig config = provider.getConfig(itemName);
        if (config == null) continue;
       
        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);
               ((SwitchItem) item).setState(status);
             }
             }           
          } else
          if (item instanceof NumberItem) {
            DecimalType value = new DecimalType(current);
            synchronized (item) {
              if (!item.getState().equals(value)) {               
                eventPublisher.postUpdate(itemName, value);
                ((NumberItem) item).setState(value);
              }
            }
          }
          if (item instanceof StringItem) {
            StringType value = new StringType(current);
            synchronized (item) {
              if (!item.getState().equals(value)) {               
                eventPublisher.postUpdate(itemName, value);
                ((StringItem) item).setState(value);
              }
            }           
          }
View Full Code Here

    }
  }

  private void registerChangeListenerOnItem(
      StateChangeListener stateChangeListener, String itemName) {
    Item item = ReadResource.getItem(itemName);
    if (item instanceof GenericItem) {
      GenericItem genericItem = (GenericItem) item;
      genericItem.addStateChangeListener(stateChangeListener);
     
    }
View Full Code Here

TOP

Related Classes of org.openhab.core.items.Item

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.