Skip to main content Link Search Menu Expand Document (external link)

Types

Types are the specific data types that commands and states are. They can be sent to items, be the current state of an item, or be the command, state, and was field of various triggers. Some types have additional useful methods.

OnOffType

OnOffType is the data type used by SwitchItem.

MethodDescription
on?If it’s ON
off?If it’s OFF

UpDownType

MethodDescription
up?If it’s UP
down?If it’s DOWN

PercentType

PercentType is the data type used by DimmerItem and RollershutterItem

MethodDescription
up?The value is first coerced to UpDownType, then if it’s UP
down?The value is first coerced to UpDownType, then if it’s DOWN
on?The value is first coerced to OnOffType, then if it’s ON
off?The value is first coerced to OnOffType, then if it’s OFF
scale(range)Scale the value to the given range. I.e. PercentType.new(50).scale(-50..10) => -20
to_byteScale the value to a byte (i.e. 0-255)