Python API
This reference introduces the primary SDK types. For complete signatures and examples, use the full context and source code in sdk/src/odevice/.
App
App owns the runtime model, devices, pages, configuration, and server lifecycle.
from odevice import App
app = App("Factory Demo")
app.run()Typical responsibilities:
app.add(device)registers an entity/device.app.add_page(page)adds an optional backend-declared page.app.run()starts the local runtime.
Device
Device groups related properties and commands under a stable ID.
from odevice import Device, Number, Boolean
pump = Device(
id="pump-01",
name="Main Pump",
properties={
"pressure": Number(unit="bar", min=0, max=10),
"power": Boolean(writable=True),
},
)Use device.update(...) to publish new backend state. Use @device.on_write("property") to handle a writable property from the UI.
Property types
The SDK provides semantic property types such as Number, Boolean, text/state values, and presentation hints. See Properties for the renderer contract and examples.
Pages
Use Page and Section when the backend should declare additional, semantically organized application tabs. See Pages & sections.
Source of truth
The Python runtime remains authoritative. The Web and Mobile apps render a runtime schema and do not replace backend validation or authorization.