Power sensor API | Component APIs

Power sensor API

The power sensor API allows you to give commands to your power sensor components for getting measurements of voltage, current, and power consumption.

The power sensor component supports the following methods:

Method Name Description
GetVoltage Return the voltage reading of a specified device and whether it is AC or DC.
GetCurrent Return the current of a specified device and whether it is AC or DC.
GetPower Return the power reading in watts.
GetReadings Get the measurements or readings that this power sensor provides.
Reconfigure Reconfigure this resource.
DoCommand Execute model-specific commands that are not otherwise defined by the component API.
GetResourceName Get the ResourceName for this power sensor.
Close Safely shut down the resource and prevent further use.

API

GetVoltage

Return the voltage reading of a specified device and whether it is AC or DC.

Parameters:

Returns:

Example:


For more information, see the Python SDK Docs.

GetCurrent

Return the current of a specified device and whether it is AC or DC.

Parameters:

Returns:

Example:


For more information, see the Python SDK Docs.

GetPower

Return the power reading in watts.

Parameters:

Returns:

Example:


For more information, see the Python SDK Docs.

GetReadings

Get the measurements or readings that this power sensor provides. If a sensor is not configured to have a measurement or fails to read a piece of data, it will not appear in the readings dictionary.

Parameters:

Returns:

Example:


For more information, see the Python SDK Docs.

Reconfigure

Reconfigure this resource. Reconfigure must reconfigure the resource atomically and in place.

Parameters:

Returns:

For more information, see the Go SDK Docs.

DoCommand

Execute model-specific commands that are not otherwise defined by the component API. Most models do not implement DoCommand. Any available model-specific commands should be covered in the model’s documentation. If you are implementing your own power sensor and want to add features that have no corresponding built-in API method, you can implement them with DoCommand.

Parameters:

Returns:

Raises:

Example:


For more information, see the Python SDK Docs.

GetResourceName

Get the ResourceName for this power sensor.

Parameters:

Returns:

Example:


For more information, see the Python SDK Docs.

Close

Safely shut down the resource and prevent further use.

Parameters:

Returns:

Example:


For more information, see the Python SDK Docs.