π‘ Device Type Registry
Single source of truth: packages/shared/src/types/deviceTypeRegistry.ts β. Backend syncs to DB on startup via syncFromRegistry().
Taxonomyβ
Conceptsβ
| Term | Meaning |
|---|---|
| DeviceTypeId | Unique identifier (matches firmware device_type string) |
| Category | sensor (reads env) or actuator (controls) |
| Capabilities | State keys the device publishes via MQTT (must match field name in {"state":{...}}) |
| Commands | Actions Backend sends to device (enum value matches firmware addCommandHandler()) |
| Events | Actions device publishes via MQTT /event topic β device_event (auto) or user_event (button press) |
| Periodic | true = device sends telemetry on interval; false = event-driven |
Current Typesβ
| Type | Category | Capabilities | Commands | Events |
|---|---|---|---|---|
climate | sensor | temperature, humidity, pressure | β | β |
pir | sensor | motion | β | motion_detected, motion_cleared |
switch-pir | sensor | motion, button | β | button_press, motion_detected, motion_cleared |
light | actuator | on, brightness | toggle, set_brightness, turn_on, turn_off | turned_on, turned_off |
Adding a New Typeβ
Frontend Renderingβ
| Element | Component | Source |
|---|---|---|
| Capabilities (read-only) | CapabilityValues | DeviceWidget |
| Commands (button) | CommandButtons | SLIDER_COMMANDS map |
| Commands (slider) | CommandSlider | SLIDER_COMMANDS map |
user_event triggers | UserEventButtons | virtual buttons |