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

    • TYPE

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

      protected final State itemState
    • oldItemState

      protected final State oldItemState
    • lastStateUpdate

      protected final @Nullable ZonedDateTime lastStateUpdate
    • lastStateChange

      protected final @Nullable ZonedDateTime lastStateChange
  • Constructor Details

    • ItemStateChangedEvent

      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

    • getType

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

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

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

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

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

      public String toString()
      Overrides:
      toString in class Object