Class ItemStateChangedEvent

All Implemented Interfaces:
Event
Direct Known Subclasses:
GroupItemStateChangedEvent

@NonNullByDefault public class ItemStateChangedEvent extends ItemEvent
ItemStateChangedEvents can be used to deliver item state changes through the openHAB event bus. In contrast to the ItemStateEvent the ItemStateChangedEvent is only sent if the state changed. State events must be created with the ItemEventFactory.
Author:
Dennis Nobel - Initial contribution
  • Field Details Link icon

    • TYPE Link icon

      public static final String TYPE
      The item state changed event type.
    • itemState Link icon

      protected final State itemState
    • oldItemState Link icon

      protected final State oldItemState
    • lastStateUpdate Link icon

      protected final @Nullable ZonedDateTime lastStateUpdate
    • lastStateChange Link icon

      protected final @Nullable ZonedDateTime lastStateChange
  • Constructor Details Link icon

    • ItemStateChangedEvent Link icon

      protected ItemStateChangedEvent(String topic, String payload, String itemName, State newItemState, State oldItemState, @Nullable ZonedDateTime lastStateUpdate, @Nullable ZonedDateTime lastStateChange)
      Constructs a new item state changed event.
      Parameters:
      topic - the topic
      payload - the payload
      itemName - the item name
      newItemState - the new item state
      oldItemState - the old item state
      lastStateUpdate - the last state update
      lastStateChange - the last state change
  • Method Details Link icon

    • getType Link icon

      public String getType()
      Description copied from interface: Event
      Gets the event type.
      Returns:
      the event type
    • getItemState Link icon

      public State getItemState()
      Gets the item state.
      Returns:
      the item state
    • getOldItemState Link icon

      public State getOldItemState()
      Gets the old item state.
      Returns:
      the old item state
    • getLastStateUpdate Link icon

      public @Nullable ZonedDateTime getLastStateUpdate()
      Gets the timestamp of the previous state update that occurred prior to this event.
      Returns:
      the last state update
    • getLastStateChange Link icon

      public @Nullable ZonedDateTime getLastStateChange()
      Gets the timestamp of the previous state change that occurred prior to this event.
      Returns:
      the last state change
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object