Power API
Version: 1.0.0
Status:
Power interface for Thunder framework.
(Defined by Power.json)
Table of Contents
Introduction
Scope
This document describes purpose and functionality of the Power interface (version 1.0.0). It includes detailed specification about its methods and properties provided.
Case Sensitivity
All identifiers of the interfaces described in this document are case-sensitive. Thus, unless stated otherwise, all keywords, entities, properties, relations and actions should be treated as such.
Acronyms, Abbreviations and Terms
The table below provides and overview of acronyms used in this document and their definitions.
Acronym | Description |
---|---|
API | Application Programming Interface |
HTTP | Hypertext Transfer Protocol |
JSON | JavaScript Object Notation; a data interchange format |
JSON-RPC | A remote procedure call protocol encoded in JSON |
The table below provides and overview of terms and abbreviations used in this document and their definitions.
Term | Description |
---|---|
callsign | The name given to an instance of a plugin. One plugin can be instantiated multiple times, but each instance the instance name, callsign, must be unique. |
References
Ref ID | Description |
---|---|
HTTP | HTTP specification |
JSON-RPC | JSON-RPC 2.0 specification |
JSON | JSON specification |
Thunder | Thunder API Reference |
Description
Power JSON-RPC interface.
Methods
The following methods are provided by the Power interface:
Power interface methods:
Method | Description |
---|---|
set | Sets power state |
set method
Sets power state.
Parameters
Name | Type | M/O | Description |
---|---|---|---|
params | object | mandatory | ... |
params.powerstate | string | mandatory | Power state (must be one of the following: activestandby, hibernate, on, passivestandby, poweroff, suspendtoram) |
params.timeout | integer | mandatory | Time to wait for power state change |
Result
Name | Type | M/O | Description |
---|---|---|---|
result | null | mandatory | Always null (default: None) |
Errors
Message | Description |
---|---|
ERROR_GENERAL |
General failure |
ERROR_DUPLICATE_KEY |
Trying to set the same power mode |
ERROR_ILLEGAL_STATE |
Power state is not supported |
ERROR_BAD_REQUEST |
Invalid Power state or Bad JSON param data format |
Example
Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.set",
"params": {
"powerstate": "on",
"timeout": 0
}
}
Response
{
"jsonrpc": "2.0",
"id": 42,
"result": null
}
Properties
The following properties are provided by the Power interface:
Power interface properties:
Property | R/W | Description |
---|---|---|
state | read-only | Power state |
state property
Provides access to the power state.
This property is read-only.
Value
Name | Type | M/O | Description |
---|---|---|---|
(property) | string | mandatory | Power state (must be one of the following: activestandby, hibernate, on, passivestandby, poweroff, suspendtoram) |
Example
Get Request
{
"jsonrpc": "2.0",
"id": 42,
"method": "<callsign>.1.state"
}
Get Response
{
"jsonrpc": "2.0",
"id": 42,
"result": "on"
}