Class: OpenHAB::Core::Events::ItemStateChangedEvent
Overview
Instance Attribute Summary collapse
Attributes included from ItemState
#state
Attributes inherited from ItemEvent
#group, #item
#attachment, #inputs, #source
Instance Method Summary
collapse
-
#inspect ⇒ String
-
#was? ⇒ true, false
Check if state was defined (not UNDEF or NULL).
-
#was_closed? ⇒ true, false
Check if #was is (implicitly convertible to) CLOSED.
-
#was_down? ⇒ true, false
Check if #was is (implicitly convertible to) DOWN.
-
#was_null? ⇒ true, false
-
#was_off? ⇒ true, false
Check if #was is (implicitly convertible to) OFF.
-
#was_on? ⇒ true, false
Check if #was is (implicitly convertible to) ON.
-
#was_open? ⇒ true, false
Check if #was is (implicitly convertible to) OPEN.
-
#was_paused? ⇒ true, false
-
#was_playing? ⇒ true, false
-
#was_undef? ⇒ true, false
-
#was_up? ⇒ true, false
Check if #was is (implicitly convertible to) UP.
Methods included from ItemState
#closed?, #down?, #null?, #off?, #on?, #open?, #paused?, #playing?, #state?, #undef?, #up?
#payload
Instance Attribute Details
Returns the prior state of the item if it was not UNDEF or NULL, ‘nil` otherwise.
69
70
71
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 69
def was
old_item_state if was?
end
|
Instance Method Details
#inspect ⇒ String
74
75
76
77
78
79
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 74
def inspect
s = "#<OpenHAB::Core::Events::ItemStateChangedEvent item=#{item_name} " \
"state=#{item_state.inspect} was=#{old_item_state.inspect}"
s += " source=#{source.inspect}" if source
"#{s}>"
end
|
#was? ⇒ true, false
Check if state was defined (not UNDEF or NULL)
61
62
63
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 61
def was?
!old_item_state.is_a?(UnDefType)
end
|
#was_closed? ⇒ true, false
Check if #was is (implicitly convertible to) CLOSED
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 44
|
#was_down? ⇒ true, false
Check if #was is (implicitly convertible to) DOWN
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 36
|
#was_null? ⇒ true, false
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 20
|
#was_off? ⇒ true, false
Check if #was is (implicitly convertible to) OFF
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 28
|
#was_on? ⇒ true, false
Check if #was is (implicitly convertible to) ON
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 24
|
#was_open? ⇒ true, false
Check if #was is (implicitly convertible to) OPEN
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 40
|
#was_paused? ⇒ true, false
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 52
|
#was_playing? ⇒ true, false
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 48
|
#was_undef? ⇒ true, false
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 16
|
#was_up? ⇒ true, false
Check if #was is (implicitly convertible to) UP
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 32
|