hannseman / homebridge-mi-hygrothermograph

Homebridge plugin for the Xiaomi Mi Bluetooth Temperature and Humidity Sensor
MIT License
267 stars 52 forks source link

Access through Mijia BLE Gateway #25

Closed DSchumacher2104 closed 5 years ago

DSchumacher2104 commented 5 years ago

Hallo!

I'm using a Xiaomi Mijia 1080P Smart IP Camera (aka Mi Home Security Camera) which provides a BLE gateway that reads the Xiaomi Mi Bluetooth Temperature and Humidity Sensor and allows remote access to the temperatur and humidity data with Xiaomi Mi Home App. This also works with the new Xiaomi Mi Bedside Lamp, which provides the same BLE gateway.

Is it possible to connect the Xiaomi Mi Bluetooth Temperature and Humidity Sensor through this gateway with a Homebridge Plug-in to provide the temperature und humidity data in HomeKit?

Thanks for your work and help!

hannseman commented 5 years ago

Hi. Not really sure why you need to connect the temperature sensor to the Xiaomi Gateway. By using this plugin you do not need any gateway. The raw bluetooth data is parsed and made available to HomeKit. The only downside to this is that you cannot use the official Xiaomi App for viewing the temperature. If you really want to run the Xiaomi Gateway you'll need to find some other plugin - have a look at:

https://github.com/Maxmudjon/homebridge-mijia https://github.com/snOOrz/homebridge-aqara

DSchumacher2104 commented 5 years ago

No, the Xiaomi Mi Bluetooth Temperature and Humidity Sensor cannot use the Mijia or Aqara Gateway, cause they only Support Zigbee. It connects to a dedicated BLE Gateway provided by some Mijia Devices, e. g. the mentioned Xiaomi Mijia 1080P Smart IP Camera or the Xiaomi Mijia Bedside Lamp. The gateway sends the temperature and humidity data to the connected Xiaomi Mi account on Xiaomi server. I wonder if it is possible to read this account data from Xiaomi Server with a Homebridge Plugin.

hannseman commented 5 years ago

I see. I don’t know of any homebridge plugin that can do this. Maybe you can write your own?

Maybe this repo can help you to hook into the camera: https://github.com/Filipowicz251/mijia-1080P-hacks

If want to go the route of reading stuff of the Xiaomi servers you could use Charles Proxy to sniff the HTTP-traffic between the Xiaomi app and the servers and then implement your own client.

Have you tried running this plugin in parallel to the camera / bedlamp? Depending on their implementation it could work. This plugin never actually connects to the sensor but reads the data from BLE advertisement packets. This enables multiple parties to read the data at the same time. The Mi home app also behaves like this when reading temperature data directly from the sensor. I tried it by letting two iPhones read data from the same sensor at the same time and it worked just fine.

On 18 Oct 2018, at 08:21, DSchumacher2104 notifications@github.com wrote:

No, the Xiaomi Mi Bluetooth Temperature and Humidity Sensor cannot use the Mijia or Aqara Gateway, cause they only Support Zigbee. It connects to a dedicated BLE Gateway provided by some Mijia Devices, e. g. the mentioned Xiaomi Mijia 1080P Smart IP Camera or the Xiaomi Mijia Bedside Lamp. The gateway sends the temperature and humidity data to the connected Xiaomi Mi account on Xiaomi server. I wonder if it is possible to read this account data from Xiaomi Server with a Homebridge Plugin.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

DSchumacher2104 commented 5 years ago

Yes, it works perfect parallel with Bedside Lamp and your plugin on a Raspberry Pi Zero W. The BLE gateway in Bedside Lamp updates the temperatures in Mi Home App. I dont't have enough skills in programming a plugin, but i'm totally satisfied with your plugin. Thank you, great work!

hannseman commented 5 years ago

Thank you! Nice to hear that it worked out.