Capabilities
Light
Domain light: states, services, device classes and features.
Entity ids in this domain look like light.<object_id>.
Non-dimmable lights ignore brightnessPercent. Gate brightness controls on requiresEntityFeature: { colorMode: 'brightness' } in preferences.
Use in preferences
{ key: 'device', label: 'Device', type: 'entity', domainFilter: 'light', required: true }States
getState() returns the raw token. subscribe filters, entity.is() and matchesState() also accept the friendly label the app shows (any case; spaces, hyphens and underscores interchangeable).
| Device class | on | off |
|---|---|---|
| any | On | Off |
subscribe($g.device, { to: 'on' }, onChange);
subscribe($g.device, { to: 'On' }, onChange); // same thing, by label
if ($g.device.is('On')) { /* … */ }Services
Curated for smart apps (also offered by the wizard action catalog):
| Service | Parameters | Description |
|---|---|---|
toggle | — | Toggle |
turnOff | transition (number, 0–300) | Turn off |
turnOn | brightnessPercent (number, 0–100) — Leave blank to use the light's remembered brightness.transition (number, 0–300) — How long the change should take. Default: instant. | Turn on |
await $g.device.toggle();Features
Bitmask on the supportedFeatures attribute; read the values with getEntityFeatures().Light.
| Feature | Bit |
|---|---|
EFFECT | 4 |
FLASH | 8 |
TRANSITION | 32 |
Attributes
| Attribute | Type | Description |
|---|---|---|
brightnessPercent | number | 0–100 while on. |
colorMode | string | Active colour mode, one of supportedColorModes. |
supportedColorModes | string[] | e.g. onoff, brightness, color_temp, rgb. |
kelvin | number | Colour temperature when in color_temp mode. |
minColorTempKelvin | number | — |
maxColorTempKelvin | number | — |
rgbColor | [number, number, number] | — |