Browse developer docs
Read device wake mode
POSTfarm-device-work-model
Request
Send POST to /open/service with serviceName=farm-device-work-model and the common signing parameters.
Send extra fields in the JSON body
Read the current setting before planning a change.
Request example
# Requires curl 7.87+, Python 3 and OpenSSL.
: "${XAG_APP_UID:?Set XAG_APP_UID}"
: "${XAG_APP_SECRET:?Set XAG_APP_SECRET}"
timestamp=$(python3 -c 'import time; print(time.time_ns() // 1000000)')
token=$(printf "%s" "$XAG_APP_UID$timestamp$XAG_APP_SECRET" | openssl dgst -sha1 -r | cut -d " " -f 1)
curl --silent --show-error --fail-with-body --max-time 30 --request POST \
'https://open.xa.com/open/service' \
--url-query 'serviceName=farm-device-work-model' \
--url-query "appUid=$XAG_APP_UID" \
--url-query "timestamp=$timestamp" \
--url-query "token=$token" \
--header 'Content-Type: application/json' \
--data '{
"org_id": "YOUR_FARM_ID",
"fs_sn": "YOUR_FARM_SERVER_SN",
"device_type": 1
}'| Parameter | Requirement | Meaning |
|---|---|---|
org_id | Required | Authorized farm or organization ID. |
fs_sn | Required | Farm server serial from farm-server-list. |
device_type | Required | Wake-mode grouping, with 1 for ball valves, 2 for gate valves and 3 for water-level sensors. |
Response
data.work_model uses 1 for smart wake and 2 for fast wake.
Show example response fields and types
{
"status": "number",
"success": "boolean",
"data": {
"device_type": "number",
"work_model": "number"
},
"message": "string"
}