Closed ratcashdev closed 6 years ago
please advice how to make this code mergeable.
@ThomDietrich , @open-homeautomation
Does it make sense to add support for the "XIAOMI MIJIA Temp and Humidity Sensor v2" into this library? From looking at the code there are quite a few similarities, but it would certainly extend the scope of this library from the plant sensors.
IMHO, the best solution would be to extract all the back-end code into a separate package and then make both miflora and mitemp require those. I assume a lot of other sensors with bluetooth and their implementation would benefit from a common back-end providing 3 different implementation options (bluepy, pygatt, gatttool).
@ratcashdev I started extracting the backend funktionality: https://github.com/ChristianKuehnel/btlewrap
This is from the current master branch, without your notification extensions...
Lovely! Let me know when that is merged and I will submit a separate PR for the notification enhancements.
I had the same idea, but 16 days later...:-) Anyway, I would like to help. My Home assistant installation has already my version of the mitemp_bt Sensor (so I called it) and I've putted all in a single python file using only gatttool.
@ratcashdev The bluetooth backend library is ready to get your notifications merged: https://github.com/ChristianKuehnel/btlewrap
It's also on pypi: https://pypi.python.org/pypi/btlewrap
And you can use it to build a new library to the Xiaomi Mijia sensors
PR submitted: https://github.com/ChristianKuehnel/btlewrap/pull/1
I got the mitemp implementation ready with btlewrap==0.0.2 (https://github.com/ratcashdev/mitemp) A couple of notes though:
Hi, thank you very much. I like both names, but I prefer "bt" beacuse it's more known. Once published, I will test in my Home-asssistant. Did you update the Hass component with the right dependence (the gist version has still miflora)? Thanks
repo and gist updated. See the readme for the gist's link. The new name is mitemp_bt
so back to the publishing question: Is anyone volunteering to publish?
All right. mitemp_bt==0.0.1 is available and can be integrated into hass using https://gist.github.com/ratcashdev/28253bb2c220788e4961f213fe87ff33
Thank you very much. Are you planning to create a PR to Home Assistant? Some notes:
@flavio20002
The PR is here https://github.com/home-assistant/home-assistant/pull/13955
Support for the recently announced Temp and Humidity Sensor of Xiaomi with Bluetooth and LCD display. I did not want to duplicate all the back-end code, thus added support for an extra sensor in this package.
To be fully used, it needs a file called
site-packages/homeassistant/components/sensor/mitemp.py
that is just a slightly amended version of the miflora.py, available here: https://gist.github.com/ratcashdev/2060fd95158dacae93a80a92ae7083a4