Skip to content

Control

Send commands to devices.

Every call needs the project’s API key in x-header-apikey. See Authentication. Errors use the codes in Error codes.

Publish a JSON control message to one machine

Section titled “Publish a JSON control message to one machine”
POST https://openapi.rogo.com.vn/api/v2.0/iot-core/control/device/json/{userId}/{mac}

The body is the JSON message itself: {"type":"alert.ack","aid":…,"code":…,"state":…} or {"type":"config.set","configVersion":…,"values":{…}}. It is delivered inside the device’s SET envelope on the machine’s command topic (the device logs svcmsg received), so send the JSON, not a frame. At most 1024 UTF-8 bytes. config.set is published retained only without a scope or with scope: "core"; a config.set of another scope is not retained, so it cannot replace the core configuration on the topic.

Parameter In Type Required Description
userId path string Yes
mac path string Yes
Terminal window
curl -X POST "https://openapi.rogo.com.vn/api/v2.0/iot-core/control/device/json/<userId>/<mac>" \
-H "x-header-apikey: $API_KEY"
Status Meaning
201 The message was published to the machine’s command topic.
400 The message is not a valid control message, or it is larger than 1024 UTF-8 bytes.
404 No such machine for this caller.

Read one machine’s state from the machine now

Section titled “Read one machine’s state from the machine now”
POST https://openapi.rogo.com.vn/api/v2.0/iot-core/control/device/get-state/{userId}/{mac}

Sends GET DEVICE STATE to the machine and waits up to 5 seconds for its answer, returned decoded: elements is { &lt;element>: { &lt;attr>: [attrId, ...values] } }, the array a control command carries. includeSubDevices also asks a hub for its sub-devices, returned in subDevices by eid. reportedAt is when the answer arrived.

Parameter In Type Required Description
userId path string Yes
mac path string Yes

Body

Field Type Required Description
includeSubDevices boolean No Also ask a hub’s sub-devices to report (MsgData byte 2 of GET DEVICE STATE).
Terminal window
curl -X POST "https://openapi.rogo.com.vn/api/v2.0/iot-core/control/device/get-state/<userId>/<mac>" \
-H "x-header-apikey: $API_KEY" \
-H "content-type: application/json" \
-d '{"includeSubDevices":false}'
Status Meaning
201 The machine’s answer.
404 No such machine for this caller.
504 The machine did not answer in time.
Example answer
{
"success": true,
"mac": "404cca43036c",
"reportedAt": "2026-11-25T08:12:29.700Z",
"elements": {
"1": {
"1": [
1,
0
]
},
"2": {
"1": [
1,
1
]
}
},
"subDevices": {}
}
POST https://openapi.rogo.com.vn/api/v2.0/iot-core/control/device

Body

Field Type Required Description
eid number Yes EID
elementIds string[] Yes List of Element IDs
command string[] Yes Command details as an array where the first element is the attribute and the rest are values
endpoint string Yes Endpoint
partnerId string Yes Partner ID. Ignored: the command is always addressed under the partner of the api key. Still accepted so existing callers keep working.
rootUuid string Yes Root UUID
protocolCtl number Yes Protocol Control
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":[123,456],"command":[1,0,1,2],"endpoint":"http://example.com","partnerId":"rogo","rootUuid":"66d92670359ed4c531244b61","protocolCtl":123}'
Status Meaning
201 Device control command sent successfully.
400 Bad Request.
POST https://openapi.rogo.com.vn/api/v2.0/iot-core/control/device/batch

At most 200 commands, each shaped like the body of POST control/device. Commands are addressed under the partner of the api key. The response lists every command by its index with success and, when it failed, error; success at the top is true only when all of them were sent.

Body

Field Type Required Description
commands object[] Yes The commands to send, at most 200. Each has the shape of the single-command body; the partner is the api key’s.
commands[].eid number Yes EID
commands[].elementIds string[] Yes List of Element IDs
commands[].command string[] Yes Command details as an array where the first element is the attribute and the rest are values
commands[].endpoint string Yes Endpoint
commands[].rootUuid string Yes Root UUID
commands[].protocolCtl number Yes Protocol Control
Terminal window
curl -X POST "https://openapi.rogo.com.vn/api/v2.0/iot-core/control/device/batch" \
-H "x-header-apikey: $API_KEY" \
-H "content-type: application/json" \
-d '{"commands":[{"eid":12345,"elementIds":[123,456],"command":[1,0,1,2],"endpoint":"http://example.com","rootUuid":"66d92670359ed4c531244b61","protocolCtl":123}]}'
Status Meaning
201 Every command was attempted; see results for each one.
400 The body is invalid or has more than 200 commands; nothing was sent.