- Ohjeet
- Home Assistant
- The Things model and MQTT
Tämä sivu ei ole vielä saatavilla kielellä: Suomi. Se näytetään englanniksi.
The Things model and MQTTVersiosta 1.6.13 alkaen
A platform-neutral view of your server as devices with capabilities, for Home Assistant, MQTT and other smart-home platforms.
The Things model describes a Vigiora server the way smart-home platforms think: as devices (things) with capabilities, each with a state, commands and events. The Vigiora integration for Home Assistant is built on it, and any other platform can use it with a mapping table of its own.
It is part of the public API v1 from API 1.18 (catalogue 1.1 from API 1.25). It is an adapter over API v1, not a second API: what a key sees, and what a command may do, are decided by the existing operations, with their scopes, roles, camera permissions, rate limits, audit and human in the loop class.
Endpoints#
| Endpoint | Scope | What it gives |
|---|---|---|
GET /api/v1/thing-capabilities | Any key | The catalogue: kinds, capabilities, state schemas, commands, events. |
GET /api/v1/things | cameras:read | Every thing the key may see, with its capabilities' state. ?kind= filters. |
GET /api/v1/things/{thing_id} | cameras:read | One thing. |
POST /api/v1/things/{thing_id}/commands/{capability}.{command} | The scope of the operation it runs | Runs a command. The body holds its parameters. |
GET /api/v1/events/stream?format=things | events:read | Live events in the Things envelope (Server-Sent Events). |
GET /api/v1/server | Any key | Server identity and features, to detect what the server supports. |
Things#
| Kind | Id | What it is |
|---|---|---|
server | server | The Vigiora server. |
camera | camera:<id> | A camera. |
microphone | microphone:<id> | A USB microphone. |
speaker | speaker:<id> | A speaker output (admins and operators). |
room | room:<id> | A room. |
area | area:<id> | An Analytics area (analytics:read). |
external | ha:<entity_id> | A Home Assistant device shared with Vigiora through the bridge (devices:read, admins and operators). Catalogue 1.1. |
Each thing has an id, kind, name, source (vigiora or home-assistant), parent_id, site_id, room_ids, online (true, false or null when unknown), manufacturer, model and capabilities.
Capabilities#
| Capability | On | Commands |
|---|---|---|
device | server, camera, microphone | none (online and offline events) |
video_stream | camera | get_url: a signed, short-lived HLS link |
snapshot | camera | get_url: a signed picture link |
motion | camera with motion detection | none (started, ended events) |
presence | camera | none (changed event) |
object_detection | camera | none (detected event) |
alert | server, camera, microphone | acknowledge |
recording | camera, microphone | turn_on, turn_off |
ai_guardian | camera | turn_on, turn_off |
ai_mode | room | set (live, guardian, both) |
ptz | camera with PTZ | move, stop, goto_preset |
speak | camera with a speaker, speaker, room | say |
describe | camera | run |
detect_objects | camera | run |
occupancy | area | none (count, capacity, free) |
counter | area | none (in and out today) |
Home Assistant devices add contact, value, onoff, brightness, lock, alarm_mode, siren and notify. See What each kind of device can do.
The catalogue lists, for every command, the operation it runs, its scope and roles, and its hitl class: confirm means an AI agent needs the person's approval while human in the loop is on.
Commands#
A command runs exactly one existing operation as the caller. For example:
curl -s -X POST https://yourname.vigiora.com/api/v1/things/camera:12/commands/speak.say \
-H "Authorization: Bearer vgk_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"text": "Hello"}'This runs POST /api/v1/cameras/12/actions/speak and answers with thing_id, command, operation_id and the operation's own result. Errors are the operation's own, unchanged. A command the thing doesn't offer answers 404 not_found.
The commands endpoint is REST only, not an MCP tool: AI agents call the operations themselves, where human in the loop applies.
Events#
GET /api/v1/events/stream?format=things sends each event as a CloudEvents 1.0 envelope:
{
"specversion": "1.0",
"id": "01JC0Z8Q4M1V6N3B7X2K5T9W0A",
"source": "vigiora://<server id>/things/camera:12",
"type": "vigiora.motion.started",
"subject": "camera:12",
"time": "2026-11-02T13:05:00.123Z",
"datacontenttype": "application/json",
"dataschema": "vigiora:things:1.0:vigiora.motion.started",
"data": { "started_at": "2026-11-02T13:05:00.120Z" },
"vigioracapability": "motion",
"vigioracatalogversion": "1.0",
"vigioraeventtype": "motion.started"
}Types are vigiora.<capability>.<event>, for example vigiora.presence.changed, vigiora.alert.created or vigiora.ai_guardian.observed. A shared Home Assistant device sends vigiora.<capability>.changed with the subject ha:<entity_id>. ?types= still filters by the plain API v1 event types. Picture links in data are signed for the reader and valid for 15 minutes.
Write your own adapter#
- List the things and the catalogue. Use each thing's
idas your platform's unique id. - Map each capability to one of your platform's entity types with a table: one row per capability, with the state field it reads and the command it sends.
- Subscribe to
?format=thingsand update the state fromtypeandsubject. - Renew signed video links (
video_stream.get_url) before they expire. - Check
featuresinGET /api/v1/serverfirst:thingsandthings_event_formatmean the server supports this model. A404there means a server older than API 1.17.
The MQTT example#
To show that the model is not tied to Home Assistant's own integration, the server has a second adapter over the same model: from version 1.6.15, Vigiora publishes each thing to an MQTT broker, with Home Assistant MQTT discovery, retained state, events and, if you allow it, commands. It is built in: set it up under System → Integrations → MQTT. See Integrations for the settings and topics.