Binary switch
A two-state on/off switch exposing turnOn, turnOff, toggle, and getState actions.
https://hometruth.ai/schemas/binary-switch · BinarySwitch
Instances
- WaterfallShelly Plus 1 · Grounds
- Driveway gateShelly Plus 1 · Grounds
- Garage doorShelly Plus 1 · Grounds
- SprinklersRachio sprinkler zone · Grounds
- Ceiling fanTP-Link Kasa plug · Great room
- Air purifierTP-Link Kasa plug · Great room
- Window blindsShelly Plus 1 · Great room
- TurntableTP-Link Kasa plug · Great room
- Coffee machineTP-Link Kasa plug · Great room
- KettleTP-Link Kasa plug · Great room
- Pet fountainTP-Link Kasa plug · Great room
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://hometruth.ai/schemas/binary-switch",
"title": "Binary switch",
"description": "A two-state switch that is either on or off. Every implementation exposes the same four actions: turnOn, turnOff, toggle, and getState.",
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"state": {
"type": "object",
"additionalProperties": false,
"properties": {
"availability": {
"enum": [
"online",
"offline",
"degraded",
"unknown"
]
},
"observedAt": {
"type": "string",
"format": "date-time"
},
"value": {
"enum": [
"on",
"off"
]
},
"stateSource": {
"enum": [
"commanded",
"assumed"
]
},
"commandedAt": {
"type": "string",
"format": "date-time"
},
"assumedAt": {
"type": "string",
"format": "date-time"
}
},
"required": [
"availability"
],
"oneOf": [
{
"properties": {
"stateSource": false,
"commandedAt": false,
"assumedAt": false
},
"dependentRequired": {
"value": [
"observedAt"
]
}
},
{
"properties": {
"stateSource": {
"const": "commanded"
},
"value": {},
"commandedAt": {},
"observedAt": false,
"assumedAt": false
},
"required": [
"stateSource",
"value",
"commandedAt"
]
},
{
"properties": {
"stateSource": {
"const": "assumed"
},
"value": {},
"assumedAt": {},
"observedAt": false,
"commandedAt": false
},
"required": [
"stateSource",
"value",
"assumedAt"
]
}
]
},
"actions": {
"type": "object",
"additionalProperties": false,
"properties": {
"turnOn": {
"type": "object",
"additionalProperties": false,
"properties": {}
},
"turnOff": {
"type": "object",
"additionalProperties": false,
"properties": {}
},
"toggle": {
"type": "object",
"additionalProperties": false,
"properties": {}
},
"getState": {
"type": "object",
"additionalProperties": false,
"properties": {}
}
},
"required": [
"turnOn",
"turnOff",
"toggle",
"getState"
]
}
},
"required": [
"id",
"state",
"actions"
],
"examples": [
{
"id": "shelly-relay",
"state": {
"availability": "online",
"value": "off",
"observedAt": "2026-09-03T20:00:00Z"
},
"actions": {
"turnOn": {},
"turnOff": {},
"toggle": {},
"getState": {}
}
}
]
}