@NonNullByDefault public interface BusEvent
The BusEvent allows write access to the openHAB event bus from within scripts. Items should not be updated directly (setting the state property), but updates should be sent to the bus, so that all interested bundles are notified. All methods in this interface should accept null arguments and handle them gracefully, without throwing exceptions. This is to allow scripts in various languages to be more robust and not fail due to null values.
Author:
Florian Hotze - Initial contribution, Mark Herwege - DecimalType and QuantityType overrides
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    postUpdate(@Nullable String itemName, @Nullable String stateString)
    Posts a status update for a specified item to the event bus.
    void
    postUpdate(@Nullable String itemName, @Nullable String stateString, @Nullable String source)
    Posts a status update for a specified item to the event bus.
    void
    postUpdate(@Nullable Item item, @Nullable Number state)
    Posts a status update for a specified item to the event bus.
    void
    postUpdate(@Nullable Item item, @Nullable Number state, @Nullable String source)
    Posts a status update for a specified item to the event bus.
    void
    postUpdate(@Nullable Item item, @Nullable String stateString)
    Posts a status update for a specified item to the event bus.
    void
    postUpdate(@Nullable Item item, @Nullable String stateString, @Nullable String source)
    Posts a status update for a specified item to the event bus.
    void
    postUpdate(@Nullable Item item, @Nullable DecimalType state)
    Posts a status update for a specified item to the event bus.
    void
    postUpdate(@Nullable Item item, @Nullable DecimalType state, @Nullable String source)
    Posts a status update for a specified item to the event bus.
    void
    postUpdate(@Nullable Item item, @Nullable QuantityType<?> state)
    Posts a status update for a specified item to the event bus.
    void
    postUpdate(@Nullable Item item, @Nullable QuantityType<?> state, @Nullable String source)
    Posts a status update for a specified item to the event bus.
    void
    postUpdate(@Nullable Item item, @Nullable State state)
    Posts a status update for a specified item to the event bus.
    void
    postUpdate(@Nullable Item item, @Nullable State state, @Nullable String source)
    Posts a status update for a specified item to the event bus.
    void
    restoreStates(@Nullable Map<Item,@Nullable State> statesMap)
    Restores item states from a map.
    void
    sendCommand(@Nullable String itemName, @Nullable String commandString)
    Sends a command for a specified item to the event bus.
    void
    sendCommand(@Nullable String itemName, @Nullable String commandString, @Nullable String source)
    Sends a command for a specified item to the event bus.
    void
    sendCommand(@Nullable Item item, @Nullable Number command)
    Sends a number as a command for a specified item to the event bus.
    void
    sendCommand(@Nullable Item item, @Nullable Number command, @Nullable String source)
    Sends a number as a command for a specified item to the event bus.
    void
    sendCommand(@Nullable Item item, @Nullable String commandString)
    Sends a command for a specified item to the event bus.
    void
    sendCommand(@Nullable Item item, @Nullable String commandString, @Nullable String source)
    Sends a command for a specified item to the event bus.
    void
    sendCommand(@Nullable Item item, @Nullable DecimalType command)
    Sends a command for a specified item to the event bus.
    void
    sendCommand(@Nullable Item item, @Nullable DecimalType command, @Nullable String source)
    Sends a command for a specified item to the event bus.
    void
    sendCommand(@Nullable Item item, @Nullable QuantityType<?> command)
    Sends a command for a specified item to the event bus.
    void
    sendCommand(@Nullable Item item, @Nullable QuantityType<?> command, @Nullable String source)
    Sends a command for a specified item to the event bus.
    void
    sendCommand(@Nullable Item item, @Nullable Command command)
    Sends a command for a specified item to the event bus.
    void
    sendCommand(@Nullable Item item, @Nullable Command command, @Nullable String source)
    Sends a command for a specified item to the event bus.
    void
    sendTimeSeries(@Nullable String itemName, @Nullable Map<ZonedDateTime,State> values, @Nullable String policy)
    Sends a time series to the event bus
    void
    sendTimeSeries(@Nullable String itemName, @Nullable Map<ZonedDateTime,State> values, @Nullable String policy, @Nullable String source)
    Sends a time series to the event bus
    void
    sendTimeSeries(@Nullable Item item, @Nullable TimeSeries timeSeries)
    Sends a time series to the event bus
    void
    sendTimeSeries(@Nullable Item item, @Nullable TimeSeries timeSeries, @Nullable String source)
    Sends a time series to the event bus
    storeStates(@Nullable Item @Nullable ... items)
    Stores the current states for a list of items in a map.
  • Method Details

    • sendCommand

      void sendCommand(@Nullable Item item, @Nullable Command command)
      Sends a command for a specified item to the event bus.
      Parameters:
      item - the item to send the command to
      command - the command to send
    • sendCommand

      void sendCommand(@Nullable Item item, @Nullable Command command, @Nullable String source)
      Sends a command for a specified item to the event bus.
      Parameters:
      item - the item to send the command to
      command - the command to send
      source - the source of the command
    • sendCommand

      void sendCommand(@Nullable Item item, @Nullable Number command)
      Sends a number as a command for a specified item to the event bus.
      Parameters:
      item - the item to send the command to
      command - the number to send as a command
    • sendCommand

      void sendCommand(@Nullable Item item, @Nullable Number command, @Nullable String source)
      Sends a number as a command for a specified item to the event bus.
      Parameters:
      item - the item to send the command to
      command - the number to send as a command
      source - the source of the command
    • sendCommand

      void sendCommand(@Nullable Item item, @Nullable DecimalType command)
      Sends a command for a specified item to the event bus.
      Parameters:
      item - the item to send the command to
      command - the command to send
    • sendCommand

      void sendCommand(@Nullable Item item, @Nullable DecimalType command, @Nullable String source)
      Sends a command for a specified item to the event bus.
      Parameters:
      item - the item to send the command to
      command - the command to send
      source - the source of the command
    • sendCommand

      void sendCommand(@Nullable Item item, @Nullable QuantityType<?> command)
      Sends a command for a specified item to the event bus.
      Parameters:
      item - the item to send the command to
      command - the command to send
    • sendCommand

      void sendCommand(@Nullable Item item, @Nullable QuantityType<?> command, @Nullable String source)
      Sends a command for a specified item to the event bus.
      Parameters:
      item - the item to send the command to
      command - the command to send
      source - the source of the command
    • sendCommand

      void sendCommand(@Nullable Item item, @Nullable String commandString)
      Sends a command for a specified item to the event bus.
      Parameters:
      item - the item to send the command to
      commandString - the command to send
    • sendCommand

      void sendCommand(@Nullable Item item, @Nullable String commandString, @Nullable String source)
      Sends a command for a specified item to the event bus.
      Parameters:
      item - the item to send the command to
      commandString - the command to send
      source - the source of the command
    • sendCommand

      void sendCommand(@Nullable String itemName, @Nullable String commandString)
      Sends a command for a specified item to the event bus.
      Parameters:
      itemName - the name of the item to send the command to
      commandString - the command to send
    • sendCommand

      void sendCommand(@Nullable String itemName, @Nullable String commandString, @Nullable String source)
      Sends a command for a specified item to the event bus.
      Parameters:
      itemName - the name of the item to send the command to
      commandString - the command to send
      source - the source of the command
    • postUpdate

      void postUpdate(@Nullable Item item, @Nullable State state)
      Posts a status update for a specified item to the event bus.
      Parameters:
      item - the item to send the status update for
      state - the new state of the item
    • postUpdate

      void postUpdate(@Nullable Item item, @Nullable State state, @Nullable String source)
      Posts a status update for a specified item to the event bus.
      Parameters:
      item - the item to send the status update for
      state - the new state of the item
      source - the source of the status update
    • postUpdate

      void postUpdate(@Nullable Item item, @Nullable Number state)
      Posts a status update for a specified item to the event bus.
      Parameters:
      item - the item to send the status update for
      state - the new state of the item as a number
    • postUpdate

      void postUpdate(@Nullable Item item, @Nullable Number state, @Nullable String source)
      Posts a status update for a specified item to the event bus.
      Parameters:
      item - the item to send the status update for
      state - the new state of the item as a number
      source - the source of the status update
    • postUpdate

      void postUpdate(@Nullable Item item, @Nullable DecimalType state)
      Posts a status update for a specified item to the event bus.
      Parameters:
      item - the item to send the status update for
      state - the new state of the item
    • postUpdate

      void postUpdate(@Nullable Item item, @Nullable DecimalType state, @Nullable String source)
      Posts a status update for a specified item to the event bus.
      Parameters:
      item - the item to send the status update for
      state - the new state of the item
      source - the source of the status update
    • postUpdate

      void postUpdate(@Nullable Item item, @Nullable QuantityType<?> state)
      Posts a status update for a specified item to the event bus.
      Parameters:
      item - the item to send the status update for
      state - the new state of the item
    • postUpdate

      void postUpdate(@Nullable Item item, @Nullable QuantityType<?> state, @Nullable String source)
      Posts a status update for a specified item to the event bus.
      Parameters:
      item - the item to send the status update for
      state - the new state of the item
      source - the source of the status update
    • postUpdate

      void postUpdate(@Nullable Item item, @Nullable String stateString)
      Posts a status update for a specified item to the event bus.
      Parameters:
      item - the item to send the status update for
      stateString - the new state of the item
    • postUpdate

      void postUpdate(@Nullable Item item, @Nullable String stateString, @Nullable String source)
      Posts a status update for a specified item to the event bus.
      Parameters:
      item - the item to send the status update for
      stateString - the new state of the item
      source - the source of the status update
    • postUpdate

      void postUpdate(@Nullable String itemName, @Nullable String stateString)
      Posts a status update for a specified item to the event bus.
      Parameters:
      itemName - the name of the item to send the status update for
      stateString - the new state of the item
    • postUpdate

      void postUpdate(@Nullable String itemName, @Nullable String stateString, @Nullable String source)
      Posts a status update for a specified item to the event bus.
      Parameters:
      itemName - the name of the item to send the status update for
      stateString - the new state of the item
      source - the source of the status update
    • sendTimeSeries

      void sendTimeSeries(@Nullable Item item, @Nullable TimeSeries timeSeries)
      Sends a time series to the event bus
      Parameters:
      item - the item to send the time series for
      timeSeries - a TimeSeries containing policy and values
    • sendTimeSeries

      void sendTimeSeries(@Nullable Item item, @Nullable TimeSeries timeSeries, @Nullable String source)
      Sends a time series to the event bus
      Parameters:
      item - the item to send the time series for
      timeSeries - a TimeSeries containing policy and values
      source - the source of the time series
    • sendTimeSeries

      void sendTimeSeries(@Nullable String itemName, @Nullable Map<ZonedDateTime,State> values, @Nullable String policy)
      Sends a time series to the event bus
      Parameters:
      itemName - the name of the item to send the status update for
      values - a Map containing the timeseries, composed of pairs of ZonedDateTime and State
      policy - either ADD or REPLACE
    • sendTimeSeries

      void sendTimeSeries(@Nullable String itemName, @Nullable Map<ZonedDateTime,State> values, @Nullable String policy, @Nullable String source)
      Sends a time series to the event bus
      Parameters:
      itemName - the name of the item to send the status update for
      values - a Map containing the timeseries, composed of pairs of ZonedDateTime and State
      policy - either ADD or REPLACE
      source - the source of the time series
    • storeStates

      Map<Item,State> storeStates(@Nullable Item @Nullable ... items)
      Stores the current states for a list of items in a map. A group item is not itself put into the map, but instead all its members.
      Parameters:
      items - the items for which the state should be stored
      Returns:
      the map of items with their states
    • restoreStates

      void restoreStates(@Nullable Map<Item,@Nullable State> statesMap)
      Restores item states from a map. If the saved state can be interpreted as a command, a command is sent for the item (and the physical device can send a status update if occurred). If it is no valid command, the item state is directly updated to the saved value.
      Parameters:
      statesMap - a map with (Item, State) entries