-
Notifications
You must be signed in to change notification settings - Fork 1
Home
kujohn edited this page Mar 25, 2023
·
4 revisions
Welcome to the mi_iot_token wiki!
- IID (Instance ID): Instance ID is expressed as a natural number, and it is incremented from 1 at each level in devices and homes.
- DID (Device ID): DID, short for "Device ID", is assigned by the Xiaomi IoT developer platform and used as a unique identifier to identify a specific device.
- Devices using Xiaomi Smart Modules come with a pre-installed DID.
- The DID for BLE devices is passed to the device during device addition using the Mi Home app.
- Devices integrated with the Xiaomi IoT platform using Android SDK or Linux SDK need to enter the DID provided by the Xiaomi IoT platform into the device.
- SID (Service ID): Service ID = Device ID + Service Instance ID, i.e.: ::= "."
- PID (Property ID): Property ID = Device ID + Service Instance ID + Property Instance ID, i.e.: ::= ".""."
- AID (Action ID): Action ID = Device ID + Service Instance ID + Action Instance ID, i.e.: ::= ".""."
- EID (Action ID): Event ID = Device ID + Service Instance ID + Event Instance ID, i.e.: ::= ".""."
- OID (Operation ID): A string used to identify an operation, generated automatically by the platform. OID appears in the following three places:
- The response message for setting properties includes OID.
- The response message for executing actions includes OID.
- The event notification includes OID, which is used to identify the operation that caused the event.
- Category: The device category is mainly the sub-type of the device, which can be modified by users. For example, if a user buys a socket and the socket type is outlet, which cannot be modified. But if the user connects a traditional fan to the socket, the user can modify the category of the socket to fan.
- Homes/Rooms: A user can have multiple homes, and a home can have multiple rooms.
Your can find the devices spec:
name | params | Description |
---|---|---|
getDevices | deviceIds(List<String> , optional) |
get mi cloud devices list, if not give a devices id list, will return all devices |
getDeviceData | did(String ) |
get a device info by device id |
getMiotProps | params(List , specail params) |
get a device spec propties |
setMiotProps | params(List , specail params) |
set a device spec propties |
miotAction | params(specail params) | invoke a action |
note:
- the getMiotProps specail params is like:
{"did(divice id)": "your device id", "siid(service instance id)": 2, "piid(property instance id)": 1}
- the setMiotProps specail params is like:
{"did(divice id)": "your device id", "siid(service instance id)": 2, "piid(property instance id)": 1 , "value(set the new value)": true}
- the miotAction specail params is like:
{"did(divice id)": "your device id", "siid(service instance id)": 7, "aiid(action instance id)": 1, in: [{"piid(in(piid))": 1}]}
Your can view the example config to set your device params to call the methods.
Status Code | Description |
---|---|
200 OK | The request has succeeded. |
202 Accepted | The request has been accepted for processing, but the processing has not been completed. (A notification will be sent when the processing is complete.) |
207 Multi-Status | The message body that follows is an XML message and can contain a number of separate response codes, depending on how many sub-requests were made. |
Format: 70xxxyzzz xxx: HTTP Standard Status Code y: Error Occurred Location
Value | Location |
---|---|
0 | Client |
1 | Open Platform |
2 | Device Cloud |
3 | Device |
4 | MIOT-SPEC |
zzz - Error Code
Error Code | Description |
---|---|
000 | Unknown |
001 | Device does not exist |
002 | Service does not exist |
003 | Property does not exist |
004 | Event does not exist |
005 | Action does not exist |
006 | Device description not found |
007 | Device cloud not found |
008 | Invalid ID (invalid PID, SID, AID, EID, etc.) |
009 | Scene does not exist |
011 | Device offline |
013 | Property cannot be read |
023 | Property cannot be written |
033 | Property cannot be subscribed |
043 | Property value error |
034 | Action return value error |
015 | Action execution error |
025 | Incorrect number of parameters in action |
035 | Action parameter error |
036 | Device operation timeout |
100 | The device cannot perform this operation in the current state. |
101 | The infrared device does not support this operation. |
901 | TOKEN does not exist or has expired |
902 | Illegal TOKEN |
903 | Authorization has expired |
904 | Voice device not authorized |
905 | Device is not bound |
999 | Function is not online |