ChristianKuehnel / plantgateway

Bluetooth to mqtt gateway for Xiaomi Mi plant sensors
Apache License 2.0
276 stars 43 forks source link

Add device to Home Assistant auto-discovery #39

Open PeteBa opened 5 years ago

PeteBa commented 5 years ago

This PR adds a unique_id to the discovery payload so that sensors are persisted in the Entity Registry. In addition, this adds Device information so that you can see all of the entities associated with each physical MiFlora device.

@ChristianKuehnel , I have assumed that the only devices recognised are Xiaomi (Line 304). Is that correct or does the gateway also detect other manufacturers ? Also, I see in the library that MiFloraPoller.name() does not retrieve from cache but makes an additional bluetooth connection. Would it be worth caching name in the same way that firmware_version is cached ?

eribbey commented 3 years ago

@PeteBa To respond to your question regarding other manufacturers: I'm pretty sure a lot of the other brands on Amazon at least (for example, OLLIVAN) use the exact same internals as the Xiaomi products. I was able to connect my OLLIVAN sensors without any difficulty.