2024年11月23日星期六 下午3:55:11

[token]How to get token from Mi Home Cloud

2 年 前
#2321 引用
m1:米家智能设备token获取



When you want to add xiaomi/miio devices into Domoticz, Home Assistant or Homey. You need to obtain the device token of those products. There were several methods to obtain your tokens. But most of the methods were complicated or not working anymore.

使用对象

mi home app:适用。只支持使用mi home app 接入的设备


other app

Yeelight  app:适用。Yeelight  app 和 mi home app 之间的设备会互相自动同步到对方的app

aqara home app:不适用

apple home app:不适用

这里主要使用小米硬件设备,开始之前需要获取各个设备的token。参考homeassistant获取miio token的教程

目前推荐使用云端获取的方式 https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor



Getting the token is for local control. The token is a security feature between their cloud server(and then the mobile app) and the device so that everything goes through their cloud server which then uses another security feature. The mobile app actually sets that token and syncs with the cloud server when the device is added to your account. It is the same scheme Tuya uses for example and it is as painful to obtain this token from the Tuya plugs. Not sure how far you will be able to go with this given the fact that the token is a security feature and is unlikely to be made easier to obtain…



Way 1:1.1小米云服务

1.1 .1登录设备管理器
https://i.mi.com  --随时随地,管理你的所有设备和数据

1.1.2 小米账号与云服务
https://www.mi.com/c/service/miphone/cloud/index.html

1.1.3 使用您的米家账户在小米云端直接获取设备Token或重置设备-小米云账号登录地址
https://account.xiaomi.com/



0
2 年 前
#5854 引用
Way 3 python-miio

Use python-miio get token Tokens from Mi Home Cloud

https://github.com/rytilahti/python-miio

https://python-miio.readthedocs.io/en/latest/discovery.html


Tokens from Mi Home Cloud
Tokens from Mi Home logs




Add Mi Smart Power Plug 2 (chuangmi.plug.212a01)

https://github.com/rytilahti/python-miio/issues/844



root@raspberrypi:~# miiocli cloud list
Username: 1****9
Password: *****
Locale (cn, de, i2, ru, sg, us, all): cn


output




== 米家智能插座2 蓝牙网关版2 (设备在线 ) ==
  Model: chuangmi.plug.212a01
  Token: 2408ba1
  IP: 192.168.2.109 (mac: 68:AB:)
  DID: 556285062
  Locale: cn
== Aqara 网关M1S-ZHWG15LM (设备离线 ) ==
  Model: lumi.gateway.acn01
  Token: 37426d
  IP: 192.168.2.103 (mac: 54:EF:)
  DID: 463923967
  Locale: cn
  Sub devices:
    Aqara人体传感器E1-RTCGQ11LM
      DID: lumi.158d000807d3ee
      Model: lumi.sensor_motion.aq2
    Aqara LED灯泡 T1 (可调色温)
      DID: 497913467
      Model: lumi.light.acn014
    Aqara门窗传感器E1
      DID: 522234602
      Model: lumi.magnet.acn001
== 米家蓝牙mesh led灯泡 (设备在线 ) ==
  Model: yeelink.light.mbulb3
  Token: 1d20779
  IP:  (mac: CC:B)
  DID: 1001231473
  Locale: cn
== Yeelight m2筒灯 (设备在线 ) ==
  Model: yeelink.light.ml1
  Token: adaeac8b
  IP:  (mac: CC:B5)
  DID: 1001594252
  Locale: cn
== Yeelight   1s  color 灯泡 (设备在线 ) ==
  Model: yeelink.light.color8
  Token: 0cccdf1
  IP: 192.168.2.100 (mac: EC:4D:)
  DID: 475630149
  Locale: cn
== Yeelight吸顶灯c2001 (设备在线 ) ==
  Model: yeelink.light.ceil26
  Token: db163fe450
  IP: 192.168.2.111 (mac: EC:4D)
  DID: 475810137
  Locale: cn
== 米家客厅吸顶灯 (设备在线 ) ==
  Model: yeelink.light.ceiling21
  Token: 623f1fbbc4dbcb
  IP: 192.168.2.112 (mac: EC:4D)
  DID: 476690814
  Locale: cn
== Xiaomi 中枢网关 (设备在线 ) ==
  Model: xiaomi.gateway.hub1
  Token: 6e79
  IP: 192.168.2.101 (mac: 94:F8)
  DID: 1036425604
  Locale: cn
== 插座cp2 (设备在线 ) ==
  Model: cuco.plug.cp2
  Token: 3394d8985
  IP: 192.168.2.113 (mac: 58:B6:)
  DID: 413585037
  Locale: cn
== 书房小爱音箱Pro (设备在线 ) ==
  Model: xiaomi.wifispeaker.lx06
  Token: 77326e41
  IP: 192.168.2.108 (mac: A4:39:C)
  DID: 566652514
  Locale: cn
  Sub devices:
    书房空调遥控
      DID: ir.156012917
      Model: miir.aircondition.ir02
== 小米小爱音箱Play 增强版 (设备离线 ) ==
  Model: xiaomi.wifispeaker.l05c
  Token: d1acde9828d9
  IP: 192.168.2.113 (mac: D4:35:38)
  DID: 586206753
  Locale: cn
  Sub devices:
    主卧空调遥控
      DID: ir.1557126
      Model: miir.aircondition.ir02
    风扇遥控(主卧美的sac35br)
      DID: ir.15586
      Model: miir.fan.ir01
== 小米人体传感器2(书房) (设备在线 ) ==
  Model: lumi.motion.bmgl01
  Token: 01f94e99
  IP:  (mac: 54:EF:3)
  DID: blt.3.1b6sgpm6s5k02
  Locale: cn
== 书房小米门窗传感器2 (设备在线 ) ==
  Model: isa.magnet.dw2hl
  Token: d90eacf5
  IP:  (mac: E4:AA:)
  DID: blt.3.1b9lue8fk5k00
  Locale: cn
== 领普人体传感器HS1BB (设备在线 ) ==
  Model: linp.motion.h1
  Token: be9606e5
  IP:  (mac: A4:C1:)
  DID: blt.3.1bd8tvva8lk00
  Locale: cn
== 米家人体传感器2一主卧 (设备在线 ) ==
  Model: lumi.motion.bmgl01
  Token: 2e278
  IP:  (mac: 54:EF:)
  DID: blt.3.1bv0ulpk8lo00
  Locale: cn


0
2 年 前
#5862 引用
Downgrade the app to version 5.0.19 and you'll be able to extract the token again.
I used this:
https://www.apkmirror.com/apk/xiaomi-inc/mihome/mihome-5-0-19-release/mihome-5-0-19-android-apk-download/download/
0
2 年 前
#5934 引用
Way 4 Use AlexxIT's XiaomiGateway3  get token

https://github.com/AlexxIT/XiaomiGateway3/releases


Tokens from Mi Home Cloud
0
11 个月 前
#24047 引用
Way 5 Use Alone's Xiaomi miot auto  get token

Use HomeAssistant Service
Goto HomeAssistant service developer tool
Select
 xiaomi_miot.get_token
, Enter the keyword of device name
Find the token from the HA notifications


使用HomeAssistant服务

打开HomeAssistant服务工具
选择服务xiaomi_miot.get_token,输入设备名称关键词
在HA通知列表中找到token

The service dev tool allows you to call any available service in Home Assistant.

service: xiaomi_miot.get_token
data:
  name: 插座cp2


output


list:
  - did: "413585037"
    name: 插座cp2
    host: 192.168.2.114
    model: cuco.plug.cp2
    token: 3394d89869a07032d90594a483651095
    miio_cmd: >-
      miiocli device --ip 192.168.2.114 --token 3394d89869a07032d90594a483651095
      info
    miio_info:
      life: 2958843
      uid: 2652774286
      model: cuco.plug.cp2
      token: 3394d89869a07032d90594a483651095
      ipflag: 1
      fw_ver: 2.1.3_0001
      miio_ver: 0.0.9
      hw_ver: esp8266
      mmfree: 12492
      mac: 58:B6:
      wifi_fw_ver: v3.1-52-g92240a5-dirty
      ap:
        ssid: ChinaNet-S5S7XA
        bssid: 18:F2:
        rssi: -66
        primary: 11
      netif:
        localIp: 192.168.2.114
        mask: 255.255.255.0
        gw: 192.168.2.1


0
8 个月 前
#29729 引用
https://github.com/Maxmudjon/Get_MiHome_devices_token
0
8 个月 前
#29748 引用
Way  Xiaomi-cloud-tokens-extractor

Xiaomi Cloud Tokens Extractor
Download and run token_extractor.exe for Windows or install for Python
Enter username, password and your server region
Extracts tokens from your cloud account. Also reveals the bind_key for BT devices



1.2 project  Xiaomi Cloud Tokens Extractor

https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor

How to use

his tool/script retrieves tokens for all devices connected to Xiaomi cloud and encryption keys for BLE devices.

You will need to provide Xiaomi Home credentials (not ones from Roborock app):

username (e-mail or Xiaomi Cloud account ID)
password
Xiaomi's server region (cn - China, de - Germany etc.). Leave empty to check all available
In return all of your devices connected to account will be listed, together with their name and IP address.


Example for How to use Step by step


0
8 个月 前
#29749 引用
Use MiHome mod by @vevsvevs
Down apk from СКАЧАТЬ ВЕРСИЮ 6.x.x and install   https://www.kapiba.ru/2017/11/mi-home.html
Start Mihome APP > Profile > Experimental features
Check on Write custom log files and Enable app's debug mode
Find the token from vevs/logs/misc/devices.txt after restart app
0