Power Module examples
Basic usage examples
These examples are meant to be run on the device!
If you want to run them from a remote computer, you need to change “localhost” to the IP/hostname.
You will also need to generate an access token and use the “auth basic” method.
You may also want to use the secure protocol https://.
Base URL:
<HOSTNAME>/api/power/<version>/
See Version check and device selection
Returns the power sourcing capabilities of the device.
The source_* value shows the maximum power that can be consumed on this voltage rail in milliwatt.
The source_total value shows the maximum power all rails can consume together.
The efficiency_factor* can be used to calculate the power consumption including power dissipation.
e.g: Efficiency is 90% →value is 10W → calculated dissipation is 1W → total consumption is 11W
Request:
Method: GET
URL: <HOSTNAME>/api/power/<version>/<slot>/source
Parameters:
No body parameters
Response:
{
"source_3v3": <mW>,
"source_5v0": <mW>,
"source_12v": <mW>,
"source_total": <mW>,
"efficiency_factor_3v3": <int(%)>,
"efficiency_factor_5v0": <int(%)>,
"efficiency_factor_12v": <int(%)>
}
Request:
curl http://localhost/api/power/1.0/1/source
Response:
{
"source_3v3": 17671,
"source_5v0": 22275,
"source_12v": 28750,
"source_total": 28750,
"efficiency_factor_3v3": 90,
"efficiency_factor_5v0": 90,
"efficiency_factor_12v": 100
}
Returns the internal protection table counters of the device. If an error like an over voltage event occurs the counter is increased. It can be reset by the factory reset command.
Label explanation:
opp_protection_cnt = Sum of all counters
ovp* = Over voltage protection
uvp* = Under voltage protection
pmc_temperature = Power Management Controller temperature exceeded 125°C
total_power_overload = Total power limit of the device exceeded (see /source)
Voltage limits:
3V3 rail = 3.240V - 3.440V
5V0 rail = 4.608V - 5.202V
12V rail = 11.30V - 12.77V
Request:
Method: GET
URL: <HOSTNAME>/api/power/<version>/<slot>/protectionlog
Parameters:
No body parameters
Response:
{
"opp_protection_cnt": <int>,
"ovp_cnt_3v3": <int>,
"uvp_cnt_3v3": <int>,
"ovp_cnt_5v0": <int>,
"uvp_cnt_5v0": <int>,
"ovp_cnt_12v": <int>,
"uvp_cnt_12v": <int>,
"ocp_cnt_3v3": <int>,
"ocp_cnt_5v0": <int>,
"ocp_cnt_12v": <int>,
"pmc_temperature": <int>,
"total_power_overload": <int>
}
Request:
curl http://localhost/api/power/1.0/1/protectionlog
Response:
{
"opp_protection_cnt": 0,
"ovp_cnt_3v3": 0,
"uvp_cnt_3v3": 0,
"ovp_cnt_5v0": 0,
"uvp_cnt_5v0": 0,
"ovp_cnt_12v": 0,
"uvp_cnt_12v": 0,
"ocp_cnt_3v3": 0,
"ocp_cnt_5v0": 0,
"ocp_cnt_12v": 0,
"pmc_temperature": 0,
"total_power_overload": 0
}
Returns the voltage and current statistics of the device.
Request:
Method: GET
URL: <HOSTNAME>/api/power/<version>/<slot>/stats
Parameters:
No body parameters
Response:
{
"voltage_3v3": <mV>,
"voltage_5v0": <mV>,
"voltage_12v": <mV>,
"current_3v3": <mA>,
"current_5v0": <mA>,
"current_12v": <mA>,
"limit_3v3": <mA>,
"limit_5v0": <mA>,
"limit_12v": <mA>
}
Request:
curl http://localhost/api/power/1.0/1/stats
Response:
{
"voltage_3v3": 3301,
"voltage_5v0": 4936,
"voltage_12v": 11936,
"current_3v3": 762,
"current_5v0": 536,
"current_12v": 1,
"limit_3v3": 5950,
"limit_5v0": 4950,
"limit_12v": 2400
}
Enables the watchdog timeout. The timeout is disabled after reset if the config is not saved.
“limit_3v3” must be > 1000 and < 5950 mA
“limit_5v0” must be > 1000 and < 4950 mA
“limit_12v” must be > 100 and < 2400 mA
Request:
Method: POST
URL: <HOSTNAME>/api/power/<version>/<slot>/limits
Parameters:
{
"limit_3v3": <int>,
"limit_5v0": <int>,
"limit_12v": <int>
}
Response:
{
"status": "success"
}
Request:
curl http://localhost/api/power/1.0/1/limits --header "Content-Type: application/json" --request POST --data '{"limit_3v3": 5950, "limit_5v0": 4950, "limit_12v": 2400}'
Response:
{
"status": "success"
}
Returns the temperature value of all sensors.
on_board_temp: Value from the NTC located next to the AC/DC converter
pmc_temp: Value from the PMCs internal sensor
The unit is degree Celsius.
Request:
Method: GET
URL: <HOSTNAME>/api/power/<version>/<slot>/temperature
Parameters:
No body parameters
Response:
{
"on_board_temp": <float>,
"pmc_temp": <float>
}
Request:
curl http://localhost/api/power/1.0/1/temperature
Response:
{
"on_board_temp": 40.353,
"pmc_temp": 36.632
}
If the fan mode is changed it may take up to 10 seconds until it is applied by the firmware (to prevent fan vibrations).
fan_setting_mode and fan_current_mode can be compared to check the execution status.
Returns the fan statistics.
fan_forced: False means the fan is auto controlled by the firmware. True means the setting from fan_setting mode is applied.
fan_current_mode: Shows the mode currently in use (in auto and manual mode)
fan_setting_mode: Shows the mode which will be applied if fan_forced is True.
fan_*_mode values: 0, 20, 40, 60, 80, 100 (percent)
Request:
Method: GET
URL: <HOSTNAME>/api/power/<version>/<slot>/fan
Parameters:
No body parameters
Response:
{
"fan_forced": <bool>,
"fan_current_mode": <int>,
"fan_setting_mode": <int>
}
Request:
curl http://localhost/api/power/1.0/1/fan
Response:
{
"fan_forced": false,
"fan_current_mode": 0,
"fan_setting_mode": 80
}
Changes the fan mode to the configured setting.
fan_*_mode values: 0, 20, 40, 60, 80, 100 (percent)
Request:
Method: POST
URL: <HOSTNAME>/api/power/<version>/<slot>/fan
Parameters:
{
"fan_forced": <bool>,
"fan_mode": <int>
}
Response:
{
"status": "success"
}
Request:
curl http://localhost/api/power/1.0/1/fan --header "Content-Type: application/json" --request POST --data '{"fan_forced": true, "fan_mode": 100}'
Response:
{
"status": "success"
}
Returns the fan rounds-per-minute value.
It takes at least a second to update the value after the fan mode changed.
The typical maximum value is 5000 RPM +/- 15%.
Request:
Method: GET
URL: <HOSTNAME>/api/power/<version>/<slot>/fan/rpm
Parameters:
No body parameters
Response:
{
"enabled": <bool>,
"rpm": <int>
}
Request:
curl http://localhost/api/power/1.0/1/fan/rpm
Response:
{
"enabled": false,
"rpm": 0
}
Changes the fan rounds-per-minute measurement status.
Request:
Method: POST
URL: <HOSTNAME>/api/power/<version>/<slot>/fan/rpm
Parameters:
{
"measurement_enabled": <bool>
}
Response:
{
"status": "success"
}
Request:
curl http://localhost/api/power/1.0/1/fan/rpm --header "Content-Type: application/json" --request POST --data '{"measurement_enabled": true}'
Response:
{
"status": "success"
}
Basic usage examples