Dominevo
ReferenceDevice capabilities

switch

Generic on/off switch cap for accessory children (siren, floodlight, spotlight, PIR toggle, chime silencer, autotrack enable, …).

Generic on/off switch cap for accessory children (siren, floodlight, spotlight, PIR toggle, chime silencer, autotrack enable, …). The cap owns ONLY the boolean state — driver-specific settings (brightness, sensitivity, schedule, duration) live on the device's own getSettingsUISchema() surface.

At a glance

Capabilityswitch
Provided byThe device's own driver provides it: each device registers its own provider.
Active providers per deviceone
Device typesswitch, siren, light, fan
Sourcepackages/types/src/capabilities/switch.cap.ts

Methods

Every method takes the device id (deviceId) to address the device; the input tables below list the other fields.

MethodKindRequired of a providerAccess
setStatemutationyesprotected
getOptionsquerynoprotected
powerCyclemutationnoprotected
togglemutationnoprotected

setState

mutation

Input

FieldTypeRequiredDescription
onbooleanyes

Output

Nothing.

Actions (offered in automations and on device cards)

ActionLabelSets
switch.onTurn onon = true
switch.offTurn offon = false

getOptions

query · optional for a provider

What the switch can do; absent = a plain on/off switch (SWITCH_DEFAULT_OPTIONS).

Input

No fields besides deviceId.

Output

What a switch can do, from its provider (getOptions). A provider that writes no getOptions is a plain on/off switch: the defaults are the old contract.

  • supportsSetState: false — the switch reports its state but cannot be set (a PoE port seen only through an API key). Its provider refuses setState; these surfaces withdraw on/off once the device ANSWERED this (switchRefusesSetState): the device hero, the automation action picker (offeredWhen on switch.on / switch.off / switch.toggle), the default toggle, the HomeKit, Alexa and Google exporters, and power-source on a device the switch powers (getStatus().switchSettable, offeredWhen on powerSource.on / .off, not-settable). A read that failed or is pending changes nothing.
  • supportsPowerCycle: true — the device behind the switch can cut and restore its own output in one native call (a PoE port's power cycle). It has no control of its own: a linked power-source.forceRestart uses it instead of off / wait / on.
FieldTypeRequiredDescription
supportsSetStatebooleanno (default true)
supportsPowerCyclebooleanno (default false)

powerCycle

mutation · optional for a provider

A native power cycle, declared by getOptions().supportsPowerCycle. No action of its own (no button): power-source.forceRestart on a device this switch powers calls it. Same tier as setState — it is actuation of the same output.

Input

No fields besides deviceId.

Output

Nothing.

toggle

mutation · optional for a provider

Optional on the provider type: the one default is installed at native-cap registration (withDefaultSwitchToggle) for a driver that does not write its own. No effect — the outcome is the inverse of a state this action does not name, so a scheduler cannot hold it.

Input

No fields besides deviceId.

Output

Nothing.

Actions (offered in automations and on device cards)

ActionLabelSets
switch.toggleToggle

Runtime state

The state Dominevo keeps for each device with this capability, readable without calling the provider.

Runtime-state slice — the last applied on/off state, mirrored by the kernel. Read via device.state.switch.value; UI toggles do not need to re-query the provider after a setState mutation.

FieldTypeRequiredDescription
onboolean | nullyesnull = the device has never reported its state (a measurement that has not happened is unknown, never false).
lastChangedAtnumberyesMs epoch of the last state change. Useful for UI "X minutes ago".

Events

onStateChanged

FieldTypeRequiredDescription
deviceIdnumberyes
onboolean | nullyes
lastChangedAtnumberyes