Dominevo
ReferenceHTTP API

switch

The switch router: 5 methods of the switch capability, with tier, scope, input and output.

Capability switch · scope device · mode singleton · source packages/types/src/capabilities/switch.cap.ts:57.

Every method is called at /trpc/switch.<method> — queries with GET, mutations with POST. See How to call and Authorization. Device methods take deviceId in their input.

MethodKindTierToken scopeViewer
getStatusqueryprotectedviewyes
setStatemutationprotectedcreateyes
getOptionsqueryprotectedviewyes
powerCyclemutationprotectedcreateyes
togglemutationprotectedcreateyes

switch.getStatus

  • Kind: query — GET /trpc/switch.getStatus (added by the framework)
  • Tier: protected — any signed-in principal whose scopes cover the method
  • Token scope: view on capability switch, or category device, or a device grant covering deviceId
  • Viewer: yes
  • Try it: open /system/api-explorer?method=switch.getStatus on your hub

Input

{ deviceId: number }

Output

SwitchStatusSchema

Shapes: SwitchStatusSchema

switch.setState

  • Kind: mutation — POST /trpc/switch.setState
  • Tier: protected — any signed-in principal whose scopes cover the method
  • Token scope: create on capability switch, or category device, or a device grant covering deviceId
  • Viewer: yes
  • Try it: open /system/api-explorer?method=switch.setState on your hub

Input

{ deviceId: number; on: boolean }

Output

void

switch.getOptions

  • Kind: query — GET /trpc/switch.getOptions
  • Tier: protected — any signed-in principal whose scopes cover the method
  • Token scope: view on capability switch, or category device, or a device grant covering deviceId
  • Viewer: yes
  • Try it: open /system/api-explorer?method=switch.getOptions on your hub

Input

{ deviceId: number }

Output

SwitchOptionsSchema

Shapes: SwitchOptionsSchema

switch.powerCycle

  • Kind: mutation — POST /trpc/switch.powerCycle
  • Tier: protected — any signed-in principal whose scopes cover the method
  • Token scope: create on capability switch, or category device, or a device grant covering deviceId
  • Viewer: yes
  • Try it: open /system/api-explorer?method=switch.powerCycle on your hub

Input

{ deviceId: number }

Output

void

switch.toggle

  • Kind: mutation — POST /trpc/switch.toggle
  • Tier: protected — any signed-in principal whose scopes cover the method
  • Token scope: create on capability switch, or category device, or a device grant covering deviceId
  • Viewer: yes
  • Try it: open /system/api-explorer?method=switch.toggle on your hub

Input

{ deviceId: number }

Output

void