power-source
power-source — a device that hangs is powered by a smart switch, and the operator picks that switch in the device's Customize.
power-source — a device that hangs is powered by a smart switch, and the operator picks that switch in the device's Customize. The device then offers power on, power off and a forced restart (switch off, wait, switch on).
Manual by default: nothing here restarts a device by itself. The one exception is a device's OWN provider calling forceRestart for its own device as a bounded self-recovery (unreachable for a long stretch, linked, one attempt per cooldown, never with a live session); Velux is the first. It is not the native reboot cap and never replaces or wraps it: reboot talks to the device, this cuts the power of the device that no longer answers.
The link is a Customize extension (add): one scalar target whose source is the switch. The stored composition is the ONE copy of the link and of offSeconds; the composed slice only mirrors the switch state for the UI. The methods are served by the core-blocks system provider, so they are systemMethods and carry a top-level deviceId.
Power on / off are withdrawn — and refused as not-settable — when the linked switch ANSWERED it only reports; the forced restart stays.
Every action answers a typed result and never throws for an expected refusal, so a caller tells "the switch is offline" from "a restart is already running" without parsing text.
Bounds of the off time of a forced restart, in seconds.
At a glance
| Capability | power-source |
| Provided by | One addon provides it for every device and answers by device id. |
| Active providers per device | one |
| Device types | gateway, camera, sensor, media-player, vacuum, generic, washer, dryer, dishwasher, pet-fountain, fan, humidifier, climate, water-heater |
| Source | packages/types/src/capabilities/power-source.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 |
|---|---|---|---|
getStatus | query | yes | protected |
powerOn | mutation | yes | protected |
powerOff | mutation | yes | protected |
forceRestart | mutation | yes | protected |
getStatus
query
Input
No fields besides deviceId.
Output
| Field | Type | Required | Description |
|---|---|---|---|
linked | boolean | yes | False when the device has no power source linked; the rest is then empty. |
switchDeviceId | number | null | yes | |
switchName | string | null | yes | |
switchOn | boolean | null | yes | The switch's on/off state, or null when it is unknown. Never false for unknown. |
switchOnline | boolean | null | yes | |
switchSettable | boolean | null | no | Whether the linked switch can be set (switch.getOptions().supportsSetState; a provider without the method is a plain switch, true). null = not known: no link, the switch is missing, or the read FAILED. Absent = a provider that predates the field. Only false withdraws power on / off (offeredWhen of powerSource.on / .off, the device hero) — unknown keeps them. |
restartInProgress | boolean | yes | |
offSeconds | number | yes |
powerOn
mutation
Input
No fields besides deviceId.
Output
{ accepted: true } | { accepted: false; reason: "no-power-source" | "switch-missing" | "switch-offline" | "switch-unknown" | "restart-in-progress" | "switch-call-failed" | "switch-options-unreadable" | "not-settable" | "…
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
powerSource.on | Power on |
powerOff
mutation
Input
No fields besides deviceId.
Output
{ accepted: true } | { accepted: false; reason: "no-power-source" | "switch-missing" | "switch-offline" | "switch-unknown" | "restart-in-progress" | "switch-call-failed" | "switch-options-unreadable" | "not-settable" | "…
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
powerSource.off | Power off |
forceRestart
mutation
Input
No fields besides deviceId.
Output
{ accepted: true } | { accepted: false; reason: "no-power-source" | "switch-missing" | "switch-offline" | "switch-unknown" | "restart-in-progress" | "switch-call-failed" | "switch-options-unreadable" | "not-settable" | "…
Actions (offered in automations and on device cards)
| Action | Label | Sets |
|---|---|---|
powerSource.forceRestart | Force restart |
Runtime state
The state Dominevo keeps for each device with this capability, readable without calling the provider.
| Field | Type | Required | Description |
|---|---|---|---|
switchOn | boolean | null | yes | Null while the switch has not reported: unknown is never false. |
offSeconds | number | yes | |
lastFetchedAt | number | yes |