Authors:Blaise Thompson
Post-History:2020-04-22, 2020-07-14, 2021-03-17


This YEP defines the is-sensor trait. Daemons implementing this trait make measurements.

Table of Contents


Sensors are a core component of the instrumentation ecosystem. The is-sensor trait enforces a consistent interface across all measurement devices.


Fundamentally is-sensor daemons expose one or many named channels to clients. Each channel may be a scalar or a multidimensional array. Each channel may have units.

In many cases a single sensor daemon exposes a large volume of information over the wire. Clients who wish to poll for updates may find it impractical to read out the entire state of the sensor every time. For this reason, yaq defines measurement_id, an integer that increments when the channel values are changed. A very lightweight message get_measurement_id is offered for clients to poll for updates. The measurement_id is also returned alongside channel information when get_measured is called. Clients should expect measurement_id to overflow and typically should only watch for changes.

Many is-sensor daemons also implement the closely related trait has-measure-trigger (YEP-310). Daemons which implement is-sensor without has-measure-trigger are sensors that update "spontaneously" and cannot be software triggered. Because this trait has no setters, daemons implementing only this trait should always be busy.

message: get_measured

response: {type: map, values: [float, ndarray]}

Returns map of channel_name to measured_value. Always returns additional key measurement_id.

message: get_measurement_id

response: {'type': 'int'}

Get current measurement_id. Clients are encouraged to watch for this to be updated before calling get_measured to get entire measurement.

message: get_channel_names

response: {'type': 'array', 'items': 'string'}

Get map of channel names.

message: get_channel_shapes

response: {'type': 'map', 'values': {'type': 'array', 'items': 'int'}}

Get map of current channel shapes. Scalar represented by empty list.

message: get_channel_units

response: {'type': 'map', 'values': ['null', 'string']}

Get current channel units.


This document is placed in the public domain or under the CC0-1.0-Universal license, whichever is more permissive.

built 2023-10-10 23:52:42                                      CC0: no copyright