Lox Nexus

@lox-nexus/plugin-sdk/values

The values that flow over the bus (Value) and the rules for converting between them (Converter). Wires convert with the same code, so a plugin can predict what a target receives.

Classes

Interfaces

SingleChannel

A dimmer-like channel, as carried by Loxone's Smart Actuator single channel.

Properties

channel

channel: number

0–100

fadeTime

fadeTime: number

seconds


Rgbw

Four colour channels with a fade time, as carried by Loxone's Smart Actuator RGBW.

Properties

red

red: number

0–100

green

green: number

blue

blue: number

white

white: number

fadeTime

fadeTime: number

seconds

flags

flags: number

Experimental

raw flag bits; 0x4000 marks lighting sequence steps


TunableWhite

Tunable white light: colour temperature plus brightness.

Properties

temperature

temperature: number

Kelvin; conversions keep it within 2700–6500

brightness

brightness: number

0–100

fadeTime

fadeTime: number

seconds


T5

State of a Loxone Touch/T5 button panel.

Properties

buttons

buttons: number

bitmask of pressed buttons, see T5Buttons; buttons pressed together are added

Type Aliases

Value

Value = { type: "null"; } | { type: "boolean"; value: boolean; } | { type: "number"; value: number; } | { type: "string"; value: string; } | { type: "singleChannel"; value: SingleChannel; } | { type: "rgbw"; value: Rgbw; } | { type: "tunableWhite"; value: TunableWhite; } | { type: "t5"; value: T5; }

Every value that flows over the bus. A closed union of plain data, so it survives worker and network boundaries and can be compared structurally.


ValueType

ValueType = Value["type"]

The discriminator of Value, e.g. "number". Also what a signal declares as its valueType.


ValueOf

ValueOf<T> = Extract<Value, { type: T; }>

The variant of Value for one type, e.g. ValueOf<"rgbw">.

Type Parameters

T

T extends ValueType

Variables

Value

Value: ValueFactory

Factories and helpers for values: Value.number(3), Value.boolean(true), Value.rgbw({ ... }), Value.equals(a, b). Value is also the union type of all values, so the same name works in type positions (emit(value: Value)).


ValueSchema

const ValueSchema: z.ZodType<Value>

Validates values arriving from untrusted places (workers, HTTP, persisted data). Everything it accepts can be encoded for a Miniserver: no NaN or Infinity, whole percent channels, and ranges that fit the wire fields.


ValueTypeSchema

const ValueTypeSchema: ZodEnum<{ string: "string"; number: "number"; boolean: "boolean"; null: "null"; singleChannel: "singleChannel"; rgbw: "rgbw"; tunableWhite: "tunableWhite"; t5: "t5"; }>

Validates just the type name, for example for a signal declaration.