Skip to content

Controlling devices

A command is an attribute id followed by its values:

Want Command
On [1, 1]
Off [1, 0]
Brightness 75% [28, 750] (brightness goes from 0 to 1000)

The attribute tables list every attribute and its values: commands.

POST /iot-core/control/device sends one command to one or more elements of a device.

Terminal window
curl -X POST "https://openapi.rogo.com.vn/api/v2.0/iot-core/control/device" \
-H "x-header-apikey: $API_KEY" \
-H "content-type: application/json" \
-d '{
"eid": 12345,
"elementIds": [1, 2],
"command": [1, 1],
"rootUuid": "66d92670359ed4c531244b61",
"endpoint": "<endpoint>",
"protocolCtl": 0,
"partnerId": "<your partner id>"
}'
Field From
eid, rootUuid, endpoint, protocolCtl The device, as listed by IoT Core
elementIds The elements to change. Several elements of one device change together
command The attribute and its values
partnerId Your partner id. Ignored: the key’s partner is always used

201 means the command was sent to the device. It does not mean the device did it: watch the device’s state, or ask the device.

POST /iot-core/control/device/batch takes up to 200 commands, each shaped like the single command, and answers with a result for each, in the same order. It counts as one call in your usage.

{ "commands": [ { "eid": 1, "elementIds": [1], "command": [1, 1], "…": "…" }, { "…": "…" } ] }

POST /iot-core/control/device/get-state/<userId>/<mac> asks the device now and waits up to 5 seconds for its answer:

{ "elements": { "1": { "1": [1, 1], "28": [28, 750] } }, "reportedAt": "2026-12-03T07:00:00.000Z" }

If the device does not answer in time, the call fails with status 504. Use it when you need the truth right now; otherwise read the stored state, which costs the device nothing.

Some products, such as coffee machines, take JSON messages instead of attributes: POST /iot-core/control/device/json/<userId>/<mac>, at most 1024 bytes. See the API reference.