Skip to main content
Every device of a MaihueGO machine sends a heartbeat to Horizon about every 30 seconds. Horizon turns the heartbeats into the machine’s connectivity and, when the Raspberry includes them, into the live health of each component, its history, its alerts and the clinical record. The body is validated per device: each device has its own strict shape, and only the Raspberry may report components. The schema is published as machineUptimeReportSchema in @bbrandslab/maihue-street-protocol, and the component catalogue as MACHINE_COMPONENT_CATALOG.

Endpoint

The machine key only reports for its own machine (404 otherwise). The permission is maihue-street-machine:uptime.

Component catalogue

The catalogue is closed: Horizon only knows the components below. Three critical layers and their parts, each reported by its internal. A layer is the program (controller, interface, MCU firmware); its parts are what that program drives. Report every layer and every part in every heartbeat, even when a layer is down.

Bodies per device

A bare { "device": "<device>" } is valid for every device. For the Raspberry it means “alive, no component report”: nothing about the components changes.

Component fields

A heartbeat carries at most 64 components, never the same internal twice, and no other field: unknown fields are rejected (400) and the whole heartbeat with them.

Error codes

code is free text in lowercase snake_case. Use these when they fit:

The snapshot is complete

components is the full state of the machine in every heartbeat:
  • A component that is not installed is simply not sent. Optional parts (for example the pressure or bottle dispenser sub-boards) only exist on the totems that have them; Horizon never expects them elsewhere.
  • A component Horizon already knows on this machine and that is left out turns off: Horizon marks it failed with code not_reported, records the event and opens its alert. To stop showing a part a totem no longer has, an operator deactivates it on the machine (Horizon → machine → Componentes).
  • "components": [] is a full snapshot with nothing in it: every known component turns off. Leaving components out is not the same: it reports nothing about them.

Response

  • accepted: components applied (catalogued and linked to an active link).
  • changed: components whose status changed with this heartbeat, including the ones that turned off for being left out.
  • unknown_components: internals missing from the catalogue. They are ignored, never rejected.

What Horizon does with it

  • Links: a catalogued component the machine reports for the first time is linked to it automatically (“Detected”). Deactivating a layer on a machine deactivates its parts there too; reactivating the layer leaves them as they are.
  • History: one event is stored only when a component’s status changes.
  • Alerts: a component that turns failed opens one alert (high severity for a layer, medium for a part); reporting ok again resolves it. While a layer has an open alert its parts record their failures without opening alerts of their own; when the layer recovers, each part still failing opens its own.
  • Verdict: the machine reads Con problemas when a layer failed, Degradado when any part is degraded or failed, Operativo when every component is ok, and Sin reportes when the machine has not reported its components within the offline window (10 minutes by default).
  • Realtime: each status change is published as component:status on the machine’s totem channel.
  • Touch version: a Touch heartbeat with app_version stores it in the machine’s touch_app_version, and the time of that heartbeat in touch_app_version_at, in the same update as uptime_at_touch. A heartbeat without app_version keeps the last one. The machine list and detail (GET /api/v3/maihue-street/machine[/{document_id}]) return both fields; the value is client-reported and only displayed.

Errors