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 time the previous state change occurred.
[View source]
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 20
|
Returns the time the previous state update occurred.
[View source]
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 16
|
Returns the prior state of the item if it was not UNDEF or NULL, nil
otherwise.
[View source]
77
78
79
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 77
def was
old_item_state if was?
end
|
Instance Method Details
#inspect ⇒ String
[View source]
82
83
84
85
86
87
88
89
90
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 82
def inspect
s = "#<OpenHAB::Core::Events::ItemStateChangedEvent item=#{item_name} " \
"state=#{item_state.inspect} was=#{old_item_state.inspect}"
s += " last_state_update=#{last_state_update}" if respond_to?(:last_state_update) && last_state_update
s += " last_state_change=#{last_state_change}" if respond_to?(:last_state_change) && last_state_change
s += " source=#{source.inspect}" if source
"#{s}>"
end
|
#was? ⇒ true, false
Check if state was defined (not UNDEF or NULL)
[View source]
69
70
71
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 69
def was?
!old_item_state.is_a?(UnDefType)
end
|
#was_closed? ⇒ true, false
Check if #was is (implicitly convertible to) CLOSED
[View source]
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 52
|
#was_down? ⇒ true, false
Check if #was is (implicitly convertible to) DOWN
[View source]
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 44
|
#was_null? ⇒ true, false
[View source]
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 28
|
#was_off? ⇒ true, false
Check if #was is (implicitly convertible to) OFF
[View source]
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 36
|
#was_on? ⇒ true, false
Check if #was is (implicitly convertible to) ON
[View source]
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 32
|
#was_open? ⇒ true, false
Check if #was is (implicitly convertible to) OPEN
[View source]
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 48
|
#was_paused? ⇒ true, false
[View source]
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 60
|
#was_playing? ⇒ true, false
[View source]
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 56
|
#was_undef? ⇒ true, false
[View source]
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 24
|
#was_up? ⇒ true, false
Check if #was is (implicitly convertible to) UP
[View source]
|
# File 'lib/openhab/core/events/item_state_changed_event.rb', line 40
|