rytilahti / python-miio

Python library & console tool for controlling Xiaomi smart appliances
https://python-miio.readthedocs.io
GNU General Public License v3.0
3.82k stars 564 forks source link

Xiaomi gateway 4 Wi Fi Bluetooth smart center hub ans Temp/humidity sensor data #1878

Open 3vidar opened 11 months ago

3vidar commented 11 months ago

I would like to read temperature,humidity from my sensors from the Xiaomi gateway 4.

Device information:

Use miiocli device --ip <ip address> --token <token> info.

Sensor: XMWSDJ04MMC Xiaomi Mijia Thermometer Hygrometer inkl Screen

"miiocli cloud" give me following informations:

== Xiaomi Home Hub (Gerät online ) == Model: xiaomi.gateway.hub1 Token: 7* IP: 192.168.1.101 (mac: ****) DID: 1****6 Locale: cn == Büro Temp Sensor (Gerät online ) == Model: miaomiaoce.sensor_ht.t6 Token: 3** IP: (mac: *****) DID: blt.3.*****0 Locale: cn

How can I read the temp and Humidity data from the gateway and the sonsores (I have 6 of them)?

Thank you

rytilahti commented 11 months ago

I'm not sure if that's currently easily doable, the miot schema doesn't offer anything relevant from what it seems. You can run miiocli genericmiot --ip 192.168.1.101 --token <token> status (or settings or actions) to see what types of functionalities are offered using the protocol. This will download the json schema file under $HOME/.cache/python-miio/xiaomi.gateway.hub1.json which you can also manually check (e.g., cat $HOME/.cache/python-miio/xiaomi.gateway.hub1.json|jq).

Those sensors seem to be bluetooth le devices, so if you are using homeassistant you may want to check if https://www.home-assistant.io/integrations/xiaomi_ble/ works. There are also standalone projects that decode bluetooth broadcasts, but I'm not familiar with those.