Package org.openhab.core.items.events
Class ItemStateChangedEvent
java.lang.Object
org.openhab.core.events.AbstractEvent
org.openhab.core.items.events.ItemEvent
org.openhab.core.items.events.ItemStateChangedEvent
- All Implemented Interfaces:
Event
- Direct Known Subclasses:
GroupItemStateChangedEvent
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final Stateprotected final @Nullable ZonedDateTimeprotected final @Nullable ZonedDateTimeprotected final Statestatic final StringThe item state changed event type.Fields inherited from class org.openhab.core.events.AbstractEvent
ACTOR_SEPARATOR, DELEGATION_SEPARATOR -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedItemStateChangedEvent(String topic, String payload, String itemName, State newItemState, State oldItemState, @Nullable ZonedDateTime lastStateUpdate, @Nullable ZonedDateTime lastStateChange, @Nullable String source) Constructs a new item state changed event. -
Method Summary
Modifier and TypeMethodDescriptionGets the item state.@Nullable ZonedDateTimeGets the timestamp of the previous state change that occurred prior to this event.@Nullable ZonedDateTimeGets the timestamp of the previous state update that occurred prior to this event.Gets the old item state.getType()Gets the event type.toString()Methods inherited from class org.openhab.core.items.events.ItemEvent
getItemNameMethods inherited from class org.openhab.core.events.AbstractEvent
buildDelegatedSource, buildDelegatedSource, buildSource, equals, getPayload, getSource, getTopic, hashCode
-
Field Details
-
TYPE
The item state changed event type. -
itemState
-
oldItemState
-
lastStateUpdate
-
lastStateChange
-
-
Constructor Details
-
ItemStateChangedEvent
protected ItemStateChangedEvent(String topic, String payload, String itemName, State newItemState, State oldItemState, @Nullable ZonedDateTime lastStateUpdate, @Nullable ZonedDateTime lastStateChange, @Nullable String source) Constructs a new item state changed event.- Parameters:
topic- the topicpayload- the payloaditemName- the item namenewItemState- the new item stateoldItemState- the old item statelastStateUpdate- the last state updatelastStateChange- the last state change
-
-
Method Details
-
getType
Description copied from interface:EventGets the event type.- Returns:
- the event type
-
getItemState
Gets the item state.- Returns:
- the item state
-
getOldItemState
Gets the old item state.- Returns:
- the old item state
-
getLastStateUpdate
Gets the timestamp of the previous state update that occurred prior to this event.- Returns:
- the last state update
-
getLastStateChange
Gets the timestamp of the previous state change that occurred prior to this event.- Returns:
- the last state change
-
toString
-