Skip to main content

πŸ’‘ Device Type Registry

Single source of truth: packages/shared/src/types/deviceTypeRegistry.ts β†—. Backend syncs to DB on startup via syncFromRegistry().

Taxonomy​

Concepts​

TermMeaning
DeviceTypeIdUnique identifier (matches firmware device_type string)
Categorysensor (reads env) or actuator (controls)
CapabilitiesState keys the device publishes via MQTT (must match field name in {"state":{...}})
CommandsActions Backend sends to device (enum value matches firmware addCommandHandler())
EventsActions device publishes via MQTT /event topic β€” device_event (auto) or user_event (button press)
Periodictrue = device sends telemetry on interval; false = event-driven

Current Types​

TypeCategoryCapabilitiesCommandsEvents
climatesensortemperature, humidity, pressureβ€”β€”
pirsensormotionβ€”motion_detected, motion_cleared
switch-pirsensormotion, buttonβ€”button_press, motion_detected, motion_cleared
lightactuatoron, brightnesstoggle, set_brightness, turn_on, turn_offturned_on, turned_off

Adding a New Type​

Frontend Rendering​

ElementComponentSource
Capabilities (read-only)CapabilityValuesDeviceWidget
Commands (button)CommandButtonsSLIDER_COMMANDS map
Commands (slider)CommandSliderSLIDER_COMMANDS map
user_event triggersUserEventButtonsvirtual buttons

Reference​