docs: update power module documentation

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine 2021-05-10 08:33:52 -04:00
parent 0274a641b2
commit d3c251bc52
2 changed files with 78 additions and 8 deletions

View File

@ -180,7 +180,7 @@ and Tasmota (via http) devices, HomeAssistant switch are supported.
[power device_name]
type: gpio
# The type of device. Can be either gpio, tplink_smartplug, tasmota
# or homeseer.
# shelly, homeseer, homeassistant, or loxonev1.
# This parameter must be provided.
off_when_shutdown: False
# If set to True the device will be powered off when Klipper enters
@ -241,10 +241,10 @@ timer:
# Provide a user and password if configured in Shelly (default is empty).
# If password is set but user is empty the default user "admin" will be used
# Provided an output_id (relay id) if the Shelly device supports
# more than one (default is 0).
# When timer option is used to delay the turn off make sure to set
# the state to "on" in action call_remote_method.
# So we send a command to turn it on for x sec when its already on then it turns off.
# more than one (default is 0). When timer option is used to delay the turn
# off make sure to set the state to "on" in action call_remote_method.
# So we send a command to turn it on for x sec when its already on then
# it turns off.
address:
device:
user:
@ -265,7 +265,17 @@ token:
# The above options are used for "homeassistant" devices. The
# address should be a valid ip or hostname for the homeassistant controller.
# "device" should be the ID of the switch to control.
address:
user:
password:
output_id:
# The above options are used for "loxone smart home miniserver v1 " devices.
# The address should be a valid ip or hostname for the loxone miniserver v1
# device. All entries must be configured in advance in the loxone config.
# Provide a user and password configured in loxone config.
# The output_id is the name of a programmed output, virtual input or virtual
# output in the loxone config his output_id (name) may only be used once in
# the loxone config
```
Below are some potential examples:
```ini

View File

@ -2252,6 +2252,66 @@ An array of objects containing info for each configured device.
```
#### Get Device Status
Returns the status for a single configured device.
HTTP request:
```http
GET /machine/device_power/device?device=green_led
```
JSON-RPC request:
```json
{
"jsonrpc": "2.0",
"method": "machine.device_power.get_device",
"params": {
"device": "green_led"
},
"id": 4564
}
```
Returns:
An object containing power state for the requested device:
```json
{
"green_led": "off"
}
```
#### Set Device State
Toggle, turn on, or turn off a specified device.
HTTP request:
```http
POST /machine/device_power/device?device=green_led&action=on
```
JSON-RPC request:
```json
{
"jsonrpc": "2.0",
"method": "machine.device_power.post_device",
"params": {
"device": "green_led",
"action": "on"
},
"id": 4564
}
```
!!! note
The `action` argument may be `on`, `off`, or `toggle`. Any
other value will result in an error.
Returns:
An object containing new power state for the requested device:
```json
{
"green_led": "off"
}
```
#### Get Batch Device Status
Get power status for the requested devices. At least one device must be
specified.
@ -2281,7 +2341,7 @@ An object containing power state for each requested device:
}
```
#### Power On Devices
#### Batch Power On Devices
Power on the requested devices. At least one device must be
specified.
@ -2309,7 +2369,7 @@ An object containing power state for each requested device:
}
```
#### Power Off Devices
#### Batch Power Off Devices
Power off the requested devices. At least one device must be
specified.