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:
DevicePower.SetConfig
to update the component's configurationDevicePower.GetConfig
to obtain the component's configurationDevicePower.GetStatus
to obtain the component's status
Methods
DevicePower.SetConfig
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the DevicePower component instance |
| object | Empty object |
Find more about the config properties in config section
DevicePower.GetConfig
Properties:
Property | Type | Description |
---|---|---|
| number | Id of the DevicePower component instance |
Find the DevicePower.GetConfig response properties in config section
DevicePower.GetStatus
Properties:
Property | Type | Description |
---|---|---|
| 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:
Property | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
| number | Id of the DevicePower component instance | |||||||||
| object | Information about the battery charge
| |||||||||
| object | Information about the external power source (only available if external power source is supported) |
| bool | Whether external power source is connected | ||||||
| array of type string | Whether external power source is connected |
Examples
DevicePower.SetConfig example
- DevicePower.SetConfig HTTP GET Request
- DevicePower.SetConfig Curl Request
- DevicePower.SetConfig Mos Request
http://192.168.33.1/rpc/DevicePower.SetConfig?id=0&config={}
curl -X POST -d '{"id":1,"method":"DevicePower.SetConfig","params":{"id":0,"config":{}}}' http://${SHELLY}/rpc
mos --port ${PORT} call DevicePower.SetConfig '{"id":0,"config":{}}'
Response
- DevicePower.SetConfig HTTP GET Response
- DevicePower.SetConfig Curl Response
- DevicePower.SetConfig Mos Response
null
{
"id": 1,
"src": "shellyplusht-441793cc9d30",
"params": null
}
null
DevicePower.GetConfig example
- DevicePower.GetConfig HTTP GET Request
- DevicePower.GetConfig Curl Request
- DevicePower.GetConfig Mos Request
http://192.168.33.1/rpc/DevicePower.GetConfig?id=0
curl -X POST -d '{"id":1,"method":"DevicePower.GetConfig","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call DevicePower.GetConfig '{"id":0}'
Response
- DevicePower.GetConfig HTTP GET Response
- DevicePower.GetConfig Curl Response
- DevicePower.GetConfig Mos Response
null
{
"id": 1,
"src": "shellyplusht-441793cc9d30",
"params": null
}
null
DevicePower.GetStatus example
- DevicePower.GetStatus HTTP GET Request
- DevicePower.GetStatus Curl Request
- DevicePower.GetStatus Mos Request
http://192.168.33.1/rpc/DevicePower.GetStatus?id=0
curl -X POST -d '{"id":1,"method":"DevicePower.GetStatus","params":{"id":0}}' http://${SHELLY}/rpc
mos --port ${PORT} call DevicePower.GetStatus '{"id":0}'
Response
- DevicePower.GetStatus HTTP GET Response
- DevicePower.GetStatus Curl Response
- DevicePower.GetStatus Mos Response
{
"id": 0,
"battery": {
"V": 4.87,
"percent": 50
},
"external": {
"present": false
}
}
{
"id": 1,
"src": "shellyplusht-441793cc9d30",
"params": {
"id": 0,
"battery": {
"V": 4.87,
"percent": 50
},
"external": {
"present": false
}
}
}
{
"id": 0,
"battery": {
"V": 4.87,
"percent": 50
},
"external": {
"present": false
}
}