设备实时数据 | ||||
---|---|---|---|---|
接口描述 | 设备实时数据 | |||
请求URL | https://api.solarmanpv.com/device/v1.0/currentData | |||
请求方式 | post | |||
请求类型 | application/json | |||
返回类型 | / | |||
请求参数 | ||||
参数名 | 数据类型 | 参数类型 | 是否必填 | 描述说明 |
language | string | query | N | 语言类型,示例值:zh |
authorization | string | header | Y | accessToken,示例值:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9 |
deviceId | integer | body | N | 设备在平台内的唯一标识 ,示例值:252525 |
deviceSn | string | body | Y | 设备的唯一标识 ,示例值:12583SS |
响应参数 | ||||
参数名 | 数据类型 | 参数类型 | 是否必填 | 描述说明 |
code | string | body | N | 信息码 ,示例值:10000 |
dataList | array | body | N | 数据列表 ,示例值:dataList |
key | string | body | N | 参数key ,示例值:PG_Pt1 |
name | string | body | N | 参数名称 ,示例值:电网总功率 |
unit | string | body | N | 参数单位 ,示例值:W |
value | string | body | N | 参数值 ,示例值:55 |
deviceId | integer | body | N | 设备在平台内的唯一标识 ,示例值:252525 |
deviceSn | string | body | N | 设备的唯一标识 ,示例值:12583SS |
deviceState | integer | body | N | 设备的当前状态。取值:1.在线 2.报警 3.离线 ,示例值:1 |
deviceType | string | body | N | 设备类型 ,示例值:C0LLECTOR |
msg | string | body | N | 信息描述 ,示例值:success |
success | boolean | body | N | 是否成功 ,示例值:true |
requestId | string | body | N | 请求标识 ,示例值:1d6f6eca9bee4b6483d4af064b659eec |
示例
请求体
{
"deviceId": 123456789,
"deviceSn": "deviceSn"
}
响应体
{
"code": null,
"msg": null,
"success": true,
"requestId": "requestId",
"deviceSn": "deviceSn",
"deviceId": 1234567890,
"deviceType": "INVERTER",
"deviceState": 1,
"dataList": [
{
"key": "SN1",
"value": "deviceSn",
"unit": null,
"name": "SN"
},
{
"key": "PM1",
"value": "47",
"unit": null,
"name": "Product Type"
},
{
"key": "SS_CY1",
"value": "SS_CY1",
"unit": null,
"name": "Production Compliance Country"
},
{
"key": "P_CURVv1",
"value": "4",
"unit": null,
"name": "Power Curve Version"
},
{
"key": "Pr1",
"value": "30000",
"unit": "W",
"name": "Rated Power"
},
{
"key": "HCIv1",
"value": "23",
"unit": null,
"name": "HMI Version"
},
{
"key": "DSPv1",
"value": "11",
"unit": null,
"name": "DSP Version"
},
{
"key": "DV1",
"value": "265.70",
"unit": "V",
"name": "DC Voltage PV1"
},
{
"key": "DV2",
"value": "310.30",
"unit": "V",
"name": "DC Voltage PV2"
},
{
"key": "DV3",
"value": "303.70",
"unit": "V",
"name": "DC Voltage PV3"
},
{
"key": "DV4",
"value": "221.10",
"unit": "V",
"name": "DC Voltage PV4"
},
{
"key": "DC1",
"value": "0.00",
"unit": "A",
"name": "DC Current PV1"
},
{
"key": "DC2",
"value": "0.00",
"unit": "A",
"name": "DC Current PV2"
},
{
"key": "DC3",
"value": "0.00",
"unit": "A",
"name": "DC Current PV3"
},
{
"key": "DC4",
"value": "0.00",
"unit": "A",
"name": "DC Current PV4"
},
{
"key": "DP1",
"value": "0.00",
"unit": "W",
"name": "DC Power PV1"
},
{
"key": "DP2",
"value": "0.00",
"unit": "W",
"name": "DC Power PV2"
},
{
"key": "DP3",
"value": "0.00",
"unit": "W",
"name": "DC Power PV3"
},
{
"key": "DP4",
"value": "0.00",
"unit": "W",
"name": "DC Power PV4"
},
{
"key": "AV1",
"value": "242.00",
"unit": "V",
"name": "AC Voltage R/U/A"
},
{
"key": "AV2",
"value": "240.50",
"unit": "V",
"name": "AC Voltage S/V/B"
},
{
"key": "AV3",
"value": "241.40",
"unit": "V",
"name": "AC Voltage T/W/C"
},
{
"key": "AC1",
"value": "0.00",
"unit": "A",
"name": "AC Current R/U/A"
},
{
"key": "AC2",
"value": "0.00",
"unit": "A",
"name": "AC Current S/V/B"
},
{
"key": "AC3",
"value": "0.00",
"unit": "A",
"name": "AC Current T/W/C"
},
{
"key": "APo_t1",
"value": "0.00",
"unit": "W",
"name": "Total AC Output Power (Active)"
},
{
"key": "A_Fo1",
"value": "50.01",
"unit": "Hz",
"name": "AC Output Frequency R"
},
{
"key": "Et_ge0",
"value": "8431.00",
"unit": "kWh",
"name": "Cumulative Production (Active)"
},
{
"key": "Elast_mon1",
"value": "3720",
"unit": "kWh",
"name": "Production Last Month (Active)"
},
{
"key": "Etdy_ge1",
"value": "0.00",
"unit": "kWh",
"name": "Daily Production (Active)"
},
{
"key": "Emon1",
"value": "2970",
"unit": "kWh",
"name": "Monthly Production (Active)"
},
{
"key": "PG_Pt1",
"value": "0",
"unit": "W",
"name": "Total Grid Power"
},
{
"key": "Q_PG1",
"value": "0",
"unit": "Var",
"name": "Total Grid Reactive Power"
},
{
"key": "PG_PF1",
"value": "0.00",
"unit": null,
"name": "Grid Power Factor"
},
{
"key": "S_PGt1",
"value": "0",
"unit": "VA",
"name": "Total Grid Apparent Power"
},
{
"key": "T_in1",
"value": "34.50",
"unit": "℃",
"name": "Internal Temperature"
},
{
"key": "P_thd_pct1",
"value": "100.00",
"unit": "%",
"name": "Limited Power (%)"
},
{
"key": "STon_off1",
"value": "190",
"unit": null,
"name": "On/Off Status"
}
]
}
CURL
normal
## 3.3 Real-time Data-Device
curl -X "POST" "https://api.solarmanpv.com/device/v1.0/currentData?language=en" \
-H 'Content-Type: application/json' \
-H 'Authorization: bearer PUT-YOUR-TOKEN-HERE' \
-d $'{
"deviceSn": "YOUR-DEVICE-SN"
}'
Home Assistant
https://community.home-assistant.io/t/collect-inverter-data-from-solarman-api/328760 https://reqbin.com/curl
curl --request POST \
--url 'https://api.solarmanpv.com/device/v1.0/currentData?appId=<appId>&language=en&=' \
--header 'Authorization: bearer PUT-YOUR-TOKEN-HERE' \
--header 'Content-Type: application/json' \
--data '{
"deviceSn": "YOUR-DEVICE-SN"
}'
PYTHON
# Install the Python Requests library:
# `pip install requests`
import requests
import json
def send_request():
# 3.3 设备实时数据Real-time Data-Device
# POST https://api.solarmanpv.com/device/v1.0/currentData
try:
response = requests.post(
url="https://api.solarmanpv.com/device/v1.0/currentData",
params={
"language": "zh",
},
headers={
"Content-Type": "application/json",
"Authorization": "bearer your-token",
"User-Agent":"Paw/3.3.1 (Macintosh; OS X/12.0.1) GCDHTTPRequest"
},
data=json.dumps({
"deviceSn": "deviceSn"
})
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')