Repository navigation
Design: Devices in a Tree
Status: in the store since 2026-11-04 (powered_by, power_channel, reached_through, with a check against loops); not yet on screen, and no plug drivers yet.
Devices are not a flat list. A printer hangs behind a smart plug; a power strip with a dryer and a lamp hangs behind one channel of a Shelly; one agent on a Pi serves a printer, a label printer and a bench supply. Two relations describe that, kept apart because they answer different questions.
flowchart TB
subgraph power["Powered by (energy)"]
W["Wall plug<br/>Shelly Plus 1PM"] -->|"ch 0"| S["Power strip<br/>Tasmota, 4 ch"]
S -->|"ch 1"| D["Filament dryer"]
S -->|"ch 1"| L["Lamp"]
S -->|"ch 2"| F["Fume extractor"]
P2["Shelly Plus 2PM"] -->|"ch 0"| M["MK3S"]
P2 -->|"ch 1"| O["Ortur laser"]
end
subgraph data["Reached through (data)"]
A["Agent on a Pi"] --- M2["MK3S"]
A --- DY["DYMO"]
A --- R["Riden RD6006W"]
B["MQTT broker"] --- P3["Shellies"]
end
A device hangs behind a channel of another device that switches or measures power: a Shelly Plus 2PM has two channels, a Tasmota power strip four.
- Several devices can share one channel (everything on a power strip).
- The tree can go deeper (a strip behind a wall plug). The hub refuses a loop, and a parent outside the space.
- A plug, a power meter or a bench supply is a device like any other, of its own kind (
power,supply), with its own page.
What it gives:
- The right state. A device whose plug is off shows off at the plug, not disconnected; its page offers to switch the plug on.
- Safe switching. Off is refused while something behind the plug is busy or still hot (a printer's bed or nozzle above 50 °C), unless forced, and always confirmed.
- Energy. The plug's power and energy are shown with the devices behind it and counted per job (kWh per print, per laser job).
- Rules build on it: the fume extractor on while the laser runs and two minutes after; the dryer on before a planned print; a printer off once done and cooled; the laser's power cut when its flame sensor fires.
The agent or broker a device talks to the hub through.
- Today one agent drives one machine, with one token. Next, one agent registers each machine it serves as a device of its own under itself, over one connection: a Pi with a printer, a DYMO and a bench supply.
- A Shelly reached through an MQTT broker sits under that broker the same way; the broker (or a bridge in the hub) is the device it is reached through.
- When an agent goes offline, everything under it is unreachable, not each disconnected on its own: one cause, shown once.
| Column | What |
|---|---|
machines.powered_by |
The device id of the plug (or strip, or meter) |
machines.power_channel |
Its channel, from 0 |
machines.reached_through |
The device id of the agent or broker |
All optional. set_powered_by walks up from the new parent and refuses when it meets the device itself (tested: wall plug → strip → dryer and lamp, and the loops refused).
- Plug drivers: Shelly Gen2+ (RPC over HTTP and WebSocket, MQTT) and Tasmota (MQTT, HTTP), through the agent or a broker.
- Settings: Powered by (a plug and a channel), on every device's page.
- The plug's state on the devices behind it, switching from their pages, the safety rules.
- An agent with several devices (a protocol change: devices under one agent token).
Guides
- Getting Started
- The Agent
- Updates
- Klipper
- Lasers
- Label Printers
- Cameras
- Materials
- Machine Profiles
- Supported Machines
Design
- House Style
- Hub Core v2
- Devices in a Tree
- Multi-Tenant Hub
- Consumables and Stock
- Print Farm
- Door Access
- Door Controller
- The Website
- Stream Deck (idea, WIP)
- Roadmap
Code