hannseman / homebridge-mi-hygrothermograph

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

Mi Flora support #175

Closed Kylmakalle closed 2 years ago

Kylmakalle commented 2 years ago

Hello @hannseman. I would Like to introduce a full support for Mi Flora accessories. Main purpose if this PR is to use one (non-conflicting with other) plugin for all devices using BLE broadcast advertisement packets. Closes #44 and https://github.com/honkmaster/homebridge-mi-flower-care/issues/4

Everybody can test this with terminal command in homebridge. (Make sure to have a config backup)

sudo -E -n npm install -g Kylmakalle/homebridge-mi-hygrothermograph

Accessories view

I've tested it with my plant and it looks pretty fine. image

image

Config UI

image

image

Downsides

github-actions[bot] commented 2 years ago

File Coverage Lines Branches Missing
All files 97% 98% 95% :x:
lib/accessory.js 95% 97% 94% :x: 107 125 148 356 381 527 641

Minimum allowed coverage is 100%

Generated by :monkey: cobertura-action against d13268dc7f95c93d9629c2c4d89f7a11d533d9b9

hannseman commented 2 years ago

@Kylmakalle cool thanks! 🤩

As you've noticed I've been quite slow at responding to this PR, it's a bit hectic for me at the moment but probably calm down around next week. Then I'll give this a review! Thanks again.

Kylmakalle commented 2 years ago

Hey @hannseman, it's alright! I hope that you are keeping safe and well.

I've added some more tests to acquire maximum coverage hit rate while you're taking your time.

kinoushe commented 2 years ago

Great work! I've been running a separate bridge just for Mi Flora for a long time, so it's great to be able to combine them.

The only issue I'm having is with FakeGato not working with the Mi Flora accessories. I have it enabled for each accessory but no graph data is showing in Eve, even after a few hours and restarts. The Hygrothermograph accessories are still working correctly.

hannseman commented 2 years ago

Hi @kinoushe, I think that graphing is only supported for humidity and temperature in Eve. See https://github.com/honkmaster/homebridge-mi-flower-care/issues/5

Or do you mean that not even humidity and temperature is graphed for the Mi Flora devices?

kinoushe commented 2 years ago

Hi @hannseman, yes - I mean just the humidity and temperature, the real time information is present and correct, but it isn't downloading these graphs. The "dot" just pulses in the top right bar in Eve but never updates the graphs for the Mi Flora items.

I've removed the previous Mi Flora bridge and accessories, so I don't think it's a name/device conflict from the previous setup.

hannseman commented 2 years ago

Right! Think I found the issue. For Mi Flora devices we keep track of moisture separate from the humidity emitted by the “old” sensors. In the call to add an entry to fake-gato we guard that humidity is set before adding it:

https://github.com/hannseman/homebridge-mi-hygrothermograph/blob/f6c9ff5db738c63757b979512f49e24c2e233821/lib/accessory.js#L418

I’ll push a fix in the weekend, thanks for the report 👍

kinoushe commented 2 years ago

Oh excellent, thanks @hannseman! I'll report back when the fix is out.

hannseman commented 2 years ago

@kinoushe, just pushed 3.3.1 to npm with a possible fix.

kinoushe commented 2 years ago

The Eve graphs are now working correctly with this fix 👍 Thanks again @hannseman!