-
-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add batteryMask for iBeacons #337
Conversation
Codecov Report
@@ Coverage Diff @@
## master #337 +/- ##
==========================================
+ Coverage 91.65% 91.80% +0.14%
==========================================
Files 86 86
Lines 1846 1879 +33
Branches 227 236 +9
==========================================
+ Hits 1692 1725 +33
Misses 151 151
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool addition! This complements your major/minor mask feature well. In addition to the comments on the current code it would also be great if you could write some tests for the new functionality and add the batteryMask
option to the relevant tables in bluetooth-low-energy.md
.
src/integrations/bluetooth-low-energy/bluetooth-low-energy.service.ts
Outdated
Show resolved
Hide resolved
src/integrations/bluetooth-low-energy/bluetooth-low-energy.service.ts
Outdated
Show resolved
Hide resolved
src/integrations/bluetooth-low-energy/bluetooth-low-energy.service.ts
Outdated
Show resolved
Hide resolved
src/integrations/bluetooth-low-energy/bluetooth-low-energy.service.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I will get this merged and released soon, just want to put one more thing into the release as well.
🎉 This PR is included in version 2.12.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hey PeyeBa, where did you get the Jaylee beacons you mention? I would like to buy the same beacons so I know they will work correctly and do what I need to do... |
The ones I have were distributed by Ankhmaway and Jaalee. I bought mine many years ago from a UK based retailer |
Describe the change
Some iBeacons provide battery level information in the major/minor fields. This PR adds a
batteryMask
option to identify the battery level and, if present, create a new sensor entity so that the information can be sent to, for example, Home Assistant. The mask operates on a 32bit field usingmajor
as the high two bytes andminor
as the low two bytes.So, for example, with some Jaylee beacons that provide 0-100 value in the high byte of the minor field, you can use
batteryMask: "0x0000FF00"
to extract the information. You can add the option at the BLE module or beacon level (via tagOverride).Let me know if this is useful and I can adjust docs/test as needed.
Checklist
If you changed code:
npm test
)npm run format
)If you added a new integration:
docs/integrations/
docs/.vuepress/config.js
anddocs/integrations/README.md
Additional information
Partially addresses #160