Class PowerSensorClient

A gRPC-web client for the PowerSensor component.

Implements

Constructors

Properties

callOptions: CallOptions = ...
name: string

The name of the resource.

Methods

  • Send/Receive arbitrary commands to the resource.

    Parameters

    • command: Struct

      The command to execute.

    • callOptions: CallOptions = ...

    Returns Promise<JsonValue>

    const result = await resource.doCommand({
    name: 'myCommand',
    args: { key: 'value' },
    });
  • Get Current in amps and a boolean indicating whether the voltage is AC (true) or DC (false).

    Parameters

    • extra: {} = {}
    • callOptions: CallOptions = ...

    Returns Promise<readonly [number, boolean]>

    const powerSensor = new VIAM.PowerSensorClient(
    machine,
    'my_power_sensor'
    );
    const [current, isAc] = await powerSensor.getCurrent();

    For more information, see Power Sensor API.

  • Get power in watts.

    Parameters

    • extra: {} = {}
    • callOptions: CallOptions = ...

    Returns Promise<number>

    const powerSensor = new VIAM.PowerSensorClient(
    machine,
    'my_power_sensor'
    );
    const power = await powerSensor.getPower();

    For more information, see Power Sensor API.

  • Return the readings of a sensor.

    Parameters

    • extra: {} = {}
    • callOptions: CallOptions = ...

    Returns Promise<Record<string, JsonValue>>

    const powerSensor = new VIAM.PowerSensorClient(
    machine,
    'my_power_sensor'
    );
    const readings = await powerSensor.getReadings();

    For more information, see Power Sensor API.

  • Get voltage in volts and a boolean indicating whether the voltage is AC (true) or DC (false).

    Parameters

    • extra: {} = {}
    • callOptions: CallOptions = ...

    Returns Promise<readonly [number, boolean]>

    const powerSensor = new VIAM.PowerSensorClient(
    machine,
    'my_power_sensor'
    );
    const [voltage, isAc] = await powerSensor.getVoltage();

    For more information, see Power Sensor API.

MMNEPVFCICPMFPCPTTAAATR