Module: OpenHAB::Core::Events::ItemState

Included in:
ItemStateChangedEvent, ItemStateEvent, ItemStateUpdatedEvent
Defined in:
lib/openhab/core/events/item_state_event.rb

Overview

Helpers common to ItemStateEvent and ItemStateChangedEvent.

Methods that refer to implicit conversion mean that for example a PercentType of 100% will be ‘true` for #on?, etc.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#stateState? (readonly)



68
69
70
# File 'lib/openhab/core/events/item_state_event.rb', line 68

def state
  item_state if state?
end

Instance Method Details

#closed?true, false

Check if #state is (implicitly convertible to) CLOSED



# File 'lib/openhab/core/events/item_state_event.rb', line 43


#down?true, false

Check if #state is (implicitly convertible to) DOWN



# File 'lib/openhab/core/events/item_state_event.rb', line 35


#null?true, false

Check if #state is NULL



# File 'lib/openhab/core/events/item_state_event.rb', line 19


#off?true, false

Check if #state is (implicitly convertible to) OFF



# File 'lib/openhab/core/events/item_state_event.rb', line 27


#on?true, false

Check if #state is (implicitly convertible to) ON



# File 'lib/openhab/core/events/item_state_event.rb', line 23


#open?true, false

Check if #state is (implicitly convertible to) OPEN



# File 'lib/openhab/core/events/item_state_event.rb', line 39


#paused?true, false

Check if #state is PAUSE



# File 'lib/openhab/core/events/item_state_event.rb', line 51


#playing?true, false

Check if #state is PLAY



# File 'lib/openhab/core/events/item_state_event.rb', line 47


#state?true, false

Check if #state is defined (not UNDEF or NULL)



60
61
62
# File 'lib/openhab/core/events/item_state_event.rb', line 60

def state?
  !item_state.is_a?(UnDefType)
end

#undef?true, false

Check if #state is UNDEF



# File 'lib/openhab/core/events/item_state_event.rb', line 15


#up?true, false

Check if #state is (implicitly convertible to) UP



# File 'lib/openhab/core/events/item_state_event.rb', line 31