moddef.device module¶
Runtime device facade (spec §32.4): binds a Transport to one device profile for point- and measurand-based reads/writes. Port of moddef-ts Device / go/client/client.go.
SunSpec model_relative_offset is resolved against the model ID register (offset 0 = model id, 1 = length, data at 2+) per spec §7.3 — the same convention as the Go/TS/Rust clients and the profiles in devices/.
Shared limitation kept in lockstep: composed (multi-register mantissa/exponent) points decode via the codec directly, not through the facade.
- class moddef.device.Device(profile: DeviceProfile, transport: Transport)[source]¶
Bases:
objectThe untyped runtime facade over one device profile.
- classmethod create(doc: ModDefDocument, device_id: str | None, transport: Transport) Device[source]¶
Bind a transport to the named device profile in doc (or the only one).
- async read_measurand(q: MeasurandQuery) float | int | bool | str | bytes | list[str] | dict[str, int] | datetime | Unavailable[source]¶
Read a point by its semantic measurand tuple (spec §26.1).
- async read_point(point_id: str) float | int | bool | str | bytes | list[str] | dict[str, int] | datetime | Unavailable[source]¶
Read and decode a single point by id.
- async read_points(ids: Iterable[str]) dict[str, float | int | bool | str | bytes | list[str] | dict[str, int] | datetime | Unavailable][source]¶