Skip to main content

DevicePower

The DevicePower component handles the monitoring of device's battery charge and is only available on battery-operated devices. DevicePower components are identified with devicepower:<id> in objects containing multiple component payloads.

The DevicePower component uses DevicePower as RPC namespace and implements the minimal component interface:

Methods

DevicePower.SetConfig

Properties:

PropertyTypeDescription

id

number

Id of the DevicePower component instance

config

object

Empty object

Find more about the config properties in config section

DevicePower.GetConfig

Properties:

PropertyTypeDescription

id

number

Id of the DevicePower component instance

Find the DevicePower.GetConfig response properties in config section

DevicePower.GetStatus

Properties:

PropertyTypeDescription

id

number

Id of the DevicePower component instance

Configuration

The DevicePower component does not own any configuration properties.

Status

The status of the DevicePower component contains information about the battery charge and the presence of an external power source, if such is supported. To obtain the status of the DevicePower component its id must be specified.

Properties:

PropertyTypeDescription

id

number

Id of the DevicePower component instance

battery

object

Information about the battery charge

PropertyTypeDescription

V

number or null

Battery voltage in Volts (null if valid value could not be obtained)

percent

number or null

Battery charge level in % (null if valid value could not be obtained)

external

object

Information about the external power source (only available if external power source is supported)

present

bool

Whether external power source is connected

errors

array of type string

Whether external power source is connected

Examples

DevicePower.SetConfig example

http://192.168.33.1/rpc/DevicePower.SetConfig?id=0&config={}

Response

null

DevicePower.GetConfig example

http://192.168.33.1/rpc/DevicePower.GetConfig?id=0

Response

null

DevicePower.GetStatus example

http://192.168.33.1/rpc/DevicePower.GetStatus?id=0

Response

{
"id": 0,
"battery": {
"V": 4.87,
"percent": 50
},
"external": {
"present": false
}
}