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
ItemStateChangedEvent
s 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 State
protected final @Nullable ZonedDateTime
protected final @Nullable ZonedDateTime
protected final State
static final String
The item state changed event type. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ItemStateChangedEvent
(String topic, String payload, String itemName, State newItemState, State oldItemState, @Nullable ZonedDateTime lastStateUpdate, @Nullable ZonedDateTime lastStateChange) Constructs a new item state changed event. -
Method Summary
Modifier and TypeMethodDescriptionGets the item state.@Nullable ZonedDateTime
Gets the timestamp of the previous state change that occurred prior to this event.@Nullable ZonedDateTime
Gets 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
getItemName
Methods inherited from class org.openhab.core.events.AbstractEvent
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) 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:Event
Gets 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
-