Power Sensor Component
The power sensor component provides an API for getting measurements of voltage, current, and power consumption.
If you have a physical power sensor, an API endpoint, or anything else that provides such measurements, use a power sensor component.
Configuration
To use a power sensor and get its measurements, you need to add it to your machine’s configuration.
Go to your machine’s CONFIGURE page, and add a model that supports your sensor.
The following list shows the available sensor models. For additional configuration information, click on the model name:
Add support for other models
If none of the existing models fit your use case, you can create a modular resource to add support for it.
Support Notice
There is currently no support for this component in viam-micro-server
.
API
The power sensor API 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 with the given name. |
Close | Safely shut down the resource and prevent further use. |
Troubleshooting
If your power sensor is not working as expected, follow these steps:
- Check your machine logs on the LOGS tab to check for errors.
- Review your power sensor model’s documentation to ensure you have configured all required attributes.
- Click on the TEST panel on the CONFIGURE or CONTROL tab and test if you can use the power sensor there.
If none of these steps work, reach out to us on the Community Discord and we will be happy to help.
Next steps
For general configuration and development info, see:
To capture data from the power sensor and sync it in the cloud, see the data management service.
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!