color
Color-light cap.
Color-light cap. Coexists with switch (on/off) and brightness (level) on the same device — switch toggles the bulb, brightness sets the dim level, this cap sets the chromaticity.
Three mutually-exclusive color modes are modelled — a single setColor mutation accepts whichever mode the caller wants and the provider rejects modes the bulb doesn't support:
rgb— direct red/green/blue triplet (0..255 each).hsv— hue/saturation/value (0..360 / 0..100 / 0..100).mired— color-temperature reciprocal in mireds (warm ≈ 500, cool ≈ 150). Used by tunable-white bulbs.
The slice carries the LAST-applied mode + its associated value; the provider does NOT auto-convert between modes (e.g. setting mireds zeroes out the rgb/hsv fields). UI surfaces a single color picker that picks one mode per interaction.
Sub-feature gating uses the granular DeviceFeature.LightColorRgb / LightColorHsv / LightColorMired flags — a Hue full-color bulb sets all three; a CCT-only tunable-white bulb sets only LightColorMired. The UI uses these flags to decide which color modes to expose in the picker without a slice fetch.
At a glance
| Capability | color |
| Provided by | The device's own driver provides it: each device registers its own provider. |
| Active providers per device | one |
| Device types | light |
| Source | packages/types/src/capabilities/color.cap.ts |
Methods
Every method takes the device id (deviceId) to address the device; the input tables below list the other fields.
| Method | Kind | Required of a provider | Access |
|---|---|---|---|
setColor | mutation | yes | protected |
setColor
mutation
Input
| Field | Type | Required | Description |
|---|---|---|---|
color | { mode: "rgb"; rgb: { r: number; g: number; b: number } } | { mode: "hsv"; hsv: { h: number; s: number; v: number } } | { mode: "mired"; colorTemperature: number } | yes |
Output
Nothing.
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
color.warmWhite | Warm white | |
color.coolWhite | Cool white | |
color.red | Red | |
color.green | Green | |
color.blue | Blue |
Runtime state
The state Dominevo keeps for each device with this capability, readable without calling the provider.
Runtime-state slice — the last applied color, mirrored by the kernel. Read via device.state.color.value so UI pickers surface the current chromaticity without polling the provider.
| Field | Type | Required | Description |
|---|---|---|---|
mode | "rgb" | "hsv" | "mired" | yes | Active color mode — which of rgb / hsv / colorTemperature reflects the bulb's current state. |
rgb | { r: number; g: number; b: number } | no | Populated when mode === 'rgb'. |
hsv | { h: number; s: number; v: number } | no | Populated when mode === 'hsv'. |
colorTemperature | number | no | Populated when mode === 'mired'. |
lastChangedAt | number | yes | Ms epoch of the last operator-driven change. |
Events
onColorChanged
Emitted whenever the color changes — operator action OR firmware push. Subscribers (UI color pickers, automation engines) react without polling.
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | number | yes | |
mode | "rgb" | "hsv" | "mired" | yes | |
rgb | { r: number; g: number; b: number } | no | |
hsv | { h: number; s: number; v: number } | no | |
colorTemperature | number | no | |
lastChangedAt | number | yes |