Skip to content

Instantly share code, notes, and snippets.

@marcelrv
Created January 2, 2020 00:40
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save marcelrv/20509106e97b4c7dd8c9056aefda2332 to your computer and use it in GitHub Desktop.
Save marcelrv/20509106e97b4c7dd8c9056aefda2332 to your computer and use it in GitHub Desktop.
Xiaomi MI OT links
http://miot-spec.org/miot-spec-v2/instances?status=all
http://miot-spec.org/miot-spec-v2/instances?status=debug
http://miot-spec.org/miot-spec-v2/instances?status=released
and for example air purifier 3 cn (zhimi.airpurifier.ma4)
https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:air-purifier:0000A007:zhimi-ma4:1
http://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:light:0000A001:philips-bulb:1
http://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:fan:0000A005:zhimi-sa1:1
http://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:light:0000A001:philips-sread1:1
http://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:vacuum:0000A006:rockrobo-v1:1
other queries
Type
DeviceType
http://miot-spec.org/miot-spec-v2/spec/devices
ServiceType
http://miot-spec.org/miot-spec-v2/spec/services
PropertyType
http://miot-spec.org/miot-spec-v2/spec/properties
ActionType
http://miot-spec.org/miot-spec-v2/spec/actions
EventType
http://miot-spec.org/miot-spec-v2/spec/events
DeviceType
http://miot-spec.org/miot-spec-v2/spec/device?type=urn:miot-spec-v2:device:light:0000A001
ServiceType
http://miot-spec.org/miot-spec-v2/spec/service?type=urn:miot-spec-v2:service:fan:00007808
PropertyType
http://miot-spec.org/miot-spec-v2/spec/property?type=urn:miot-spec-v2:property:on:00000006
ActionType
http://miot-spec.org/miot-spec-v2/spec/action?type=urn:miot-spec-v2:action:play:0000280B
https://github.com/MiEcosystem/miot-spec-doc/
https://translate.google.com/translate?sl=zh-CN&tl=en&u=https%3A%2F%2Fiot.mi.com%2Fnew%2Fdoc%2F02-%25E5%25BC%2580%25E5%258F%2591%25E8%2580%2585%25E9%25A1%25BB%25E7%259F%25A5%2F02-%25E5%25B0%258F%25E7%25B1%25B3IoT%25E5%258D%258F%25E8%25AE%25AE%25E8%25A7%2584%25E8%258C%2583%2F04-%25E5%25AE%259E%25E4%25BE%258B%25E5%25AE%259A%25E4%25B9%2589.html
https://github.com/Yeelight/miot-api
e.g. All outlets
http://www.miot-spec.org/instance/devices?name=outlets
http://miot-spec.org/instance/devices?vendor=yeelink
http://miot-spec.org/instance/devices
Vacuum examples
http://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:vacuum:0000A006:rockrobo-v1:1
@marcelrv
Copy link
Author

{"version_name":"12780","version_code":8,"api_level":2}
[main] INFO org.openhab.binding.miio.internal.cloud.MiCloudConnector - Send request: {"version_name":"12780","version_code":8,"api_level":2} to https://de.api.io.mi.com/app/version/check_gray
response: {"code":0,"message":"ok","result":{"new_version":0,"new_version_name":"","new_version_code":"","download_url":"http://app.mi.com/download/75542","change_log":""}}

@marcelrv
Copy link
Author


POST https://de.api.io.mi.com/app/version/online_version HTTP/1.1
data: {"api_level":2,"version_name":"5.4.38","version_code":62824}

POST https://de.api.io.mi.com/app/v2/device/multi_check_device_version HTTP/1.1
data:      {"app_level":"62824","platform":"android","check_reqs":[]}

{"code":0,"message":"","result":{"list":[]}}

POST https://de.api.io.mi.com/app/version/check_gray HTTP/1.1
data:      {"api_level":2,"version_name":"5.4.38","package_name":"com.xiaomi.smarthome.gray","version_code":62824}


POST https://de.api.io.mi.com/app/v2/miotspec/devicelist HTTP/1.1
no data resp:   {"code":0,"message":"ok","result":{"list":[{"did":"49884064","name":"Mi LED Desk Lamp   ","pd_id":150,"model":"yeelink.light.lamp1","type":"urn:miot-spec-v2:device:light:0000A001:yeelight-lamp1:1"},{"did":"55512645","name":"Mi Robot Vacuum   ","pd_id":85,"model":"rockrobo.vacuum.v1","type":"urn:miot-spec-v2:device:vacuum:0000A006:rockrobo-v1:1"}]}}

POST https://de.api.io.mi.com/app/plugin/update_plugin HTTP/1.1
data:      {"api_level":78,"app_version":62824,"plugins":[{"model":"yeelink.light.lamp1"}],"app_platform":"phone"}
{"code":0,"message":"ok","result":{"plugins":[{"model":"yeelink.light.lamp1","new_version":1,"plugin_id":47,"package_id":1598,"force":0,"version":143,"change_log":"","download_url":"http://cdn.awsde0.fds.api.mi-img.com/default/com.yeelight.lamp_2019062820090328322.zip?Expires=1585050566000&GalaxyAccessKeyId=5721718224520&Signature=w%2bTARHxTnVpUrLSqRAlDrdIZIwQ=","safe_url":"https://cdn.awsde0.fds.api.mi-img.com/default/com.yeelight.lamp_2019062820090328322.zip?Expires=1592263631000&GalaxyAccessKeyId=5721718224520&Signature=4B5DrvHs2Y1Oo7GGNlvJltepcWU=","package_name":"com.yeelight.lamp","length":11729683,"type":"MPK","api_level":51}]}}

@marcelrv
Copy link
Author

marcelrv commented Mar 18, 2020

Lastest version
POST https://de.api.io.mi.com/app/v2/plugin/fetch_plugin HTTP/1.1
data: {"latest_req":{"region":"DE","app_platform":"Android","plugins":[{"model":"rockrobo.vacuum.v1"}],"api_version":10035,"package_type":""},"backup_req":{"api_level":101,"plugins":[{"model":"rockrobo.vacuum.v1"}],"app_platform":"phone"}}

resp
{"code":0,"message":"","result":{"latest_info":[],"backup_info":[{"model":"rockrobo.vacuum.v1","new_version":1,"plugin_id":80,"package_id":1479,"force":0,"version":125,"change_log":"","download_url":"http://cdn.awsde0.fds.api.mi-img.com/default/com.rockrobo.app_2019042811141769713.zip?Expires=1587523514000&GalaxyAccessKeyId=5721718224520&Signature=Hh/xUW/pQ7yyDAZZmZSvcBPhTaA=","safe_url":"https://cdn.awsde0.fds.api.mi-img.com/default/com.rockrobo.app_2019042811141769713.zip?Expires=1592333563000&GalaxyAccessKeyId=5721718224520&Signature=eHe96RdBHEZzmuIrTzI/kzXYNSk=","package_name":"com.rockrobo.app","length":6260865,"type":"MPK","api_level":2}]}}

@marcelrv
Copy link
Author

POST https://de.api.io.mi.com/app/v2/plugin/fetch_plugin HTTP/1.1
data: {"latest_req":{"region":"DE","app_platform":"Android","plugins":[{"type":"MPK","package_id":1479,"model":"rockrobo.vacuum.v1"}],"api_version":10035,"package_type":""},"backup_req":{"api_level":101,"plugins":[{"type":"MPK","package_id":1479,"model":"rockrobo.vacuum.v1"}],"app_platform":"phone"}}

{"code":0,"message":"","result":{"latest_info":[],"backup_info":[{"model":"rockrobo.vacuum.v1","new_version":0,"plugin_id":0,"package_id":0,"force":0,"version":0,"change_log":"","download_url":"","safe_url":"","package_name":"","length":0,"type":"","api_level":0}]}}

@marcelrv
Copy link
Author

POST https://de.api.io.mi.com/app/v2/miotspec/devicelist HTTP/1.1
no data

resp =>
{"code":0,"message":"ok","result":{"list":[{"did":"49884063","name":"Mi LED Desk Lamp ","pd_id":150,"model":"yeelink.light.lamp1","type":"urn:miot-spec-v2:device:light:0000A001:yeelight-lamp1:1"},{"did":"55512643","name":"Mi Robot Vacuum ","pd_id":85,"model":"rockrobo.vacuum.v1","type":"urn:miot-spec-v2:device:vacuum:0000A006:rockrobo-v1:1"}]}}

http://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:light:0000A001:yeelight-lamp1:1

@marcelrv
Copy link
Author

Miot subcommand response codes
| 0 | Success |
| 1 | Request received, but the operation has not been completed yet |
| -4001 | Unreadable attribute |
| -4002 | Attribute is not writable |
| -4003 | Properties, methods, events do not exist |
| -4004 | Other internal errors |
| -4005 | Attribute value error |
| -4006 | Method in parameter error |
| -4007 | did error

@marcelrv
Copy link
Author

marcelrv commented Dec 8, 2020

@arturdobo
Copy link

@marcelrv do you have any idea where to find properties from cgllc-spec? Look at i.e. this device. Some of the properties are not miot-spec and have no idea where to look for them.

@sygys
Copy link

sygys commented Sep 27, 2021

I would like to download all pages from that website. Wouldnt there be a way to rip the whole website and find all pages for all devices?

@sygys
Copy link

sygys commented Sep 27, 2021

Here are 2 more for both the smart heaters ZA1 and ZB1:

https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:heater:0000A01A:zhimi-za1:1
https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:heater:0000A01A:zhimi-zb1:1

It seems like http://miot-spec.org/instance/devices is out dated or they changed to another page setup for newer devices. These heaters arent shown on there.

@sygys
Copy link

sygys commented Sep 27, 2021

Here the complete list of all devices out there...

https://miot-spec.org/miot-spec-v2/instances

Every instance in that list can be brought up by replacing the "/instances" part with "/instance?type=" and then the instance in the page i provided.

@marcelrv
Copy link
Author

not all devices support miot spec, prob your cgllc is one of those.

For older devices, typically not all commands are suported but a subset of the commands may be supported by the miot spec.
You can recognise this as these commands can't be send directly to the device, but instead, need to be send to the cloud and the Xiaomi cloud will do the translation to the device commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment