Class: OpenHAB::Core::Types::OnOffType

Inherits:
Object
  • Object
show all
Includes:
Command, State
Defined in:
lib/openhab/core/types/on_off_type.rb

Overview

Implements ON and OFF commands and states.

Also, PercentType can be converted to OnOffType for more semantic comparisons. 0 is OFF, anything else if ON.

Constant Summary collapse

ON =

On Command/State

OFF =

Off Command/State

Instance Method Summary collapse

Methods included from Type

#==, #eql?

Instance Method Details

#!OnOffType

Invert the type

Returns:



35
36
37
# File 'lib/openhab/core/types/on_off_type.rb', line 35

def !
  on? ? OFF : ON
end

#off?true, false

Check if self == OFF

Returns:

  • (true, false)


# File 'lib/openhab/core/types/on_off_type.rb', line 29

#on?true, false

Check if self == ON

Returns:

  • (true, false)


# File 'lib/openhab/core/types/on_off_type.rb', line 25