Interface Sensor

Represents a physical sensing device that can provide measurement readings.

interface Sensor {
    name: string;
    doCommand(command: Struct): Promise<JsonValue>;
    getReadings(extra?: Struct): Promise<Record<string, JsonValue>>;
}

Hierarchy (View Summary, Expand)

Implemented by

Properties

Methods

Properties

name: string

The name of the resource.

Methods

  • Send/Receive arbitrary commands to the resource.

    Parameters

    • command: Struct

      The command to execute.

    Returns Promise<JsonValue>

    const result = await resource.doCommand({
    name: 'myCommand',
    args: { key: 'value' },
    });
  • Return the readings of a sensor.

    Parameters

    Returns Promise<Record<string, JsonValue>>

    const sensor = new VIAM.SensorClient(machine, 'my_sensor');

    // Get the readings of a sensor.
    const readings = await sensor.getReadings();

    For more information, see Sensor API.

MMNEPVFCICPMFPCPTTAAATR