Bluetooth-Devices / bthome-ble

Parser for BTHome BLE devices
https://bthome.io/
MIT License
69 stars 14 forks source link

fix: multiple measurements fix #29

Closed Ernst79 closed 1 year ago

Ernst79 commented 1 year ago

I ran into the "problem" that the current implementation for multiple measurements of the same type (e.g. 3 temperatures), will result in three devices (1, 2 and 3) in Home Assistant. This is caused by the fact that I had defined one device_id per temperature. However, this is more meant for thinks like an indoor and outdoor temperature device that report via the indoor device.

I now have changed it such that we always have one device (device_id = None). Each measurement will get a postfix, in case there are more than one of that type. E.g. temperature_1, temperature_2 etc, with name Temperature 1, Temperature 2, etc.

codecov[bot] commented 1 year ago

Codecov Report

Base: 75.39% // Head: 75.39% // No change to project coverage :thumbsup:

Coverage data is based on head (849deab) compared to base (2ce1e87). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #29 +/- ## ======================================= Coverage 75.39% 75.39% ======================================= Files 6 6 Lines 443 443 Branches 65 65 ======================================= Hits 334 334 Misses 89 89 Partials 20 20 ``` | [Impacted Files](https://codecov.io/gh/Bluetooth-Devices/bthome-ble/pull/29?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [src/bthome\_ble/\_\_init\_\_.py](https://codecov.io/gh/Bluetooth-Devices/bthome-ble/pull/29/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL2J0aG9tZV9ibGUvX19pbml0X18ucHk=) | `100.00% <100.00%> (ø)` | | | [src/bthome\_ble/parser.py](https://codecov.io/gh/Bluetooth-Devices/bthome-ble/pull/29/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-c3JjL2J0aG9tZV9ibGUvcGFyc2VyLnB5) | `80.81% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.