Skip to content
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 battery_quantity attribute to battery_type entity #375

Closed
3 tasks done
nechry opened this issue Jan 5, 2024 · 5 comments · Fixed by #389
Closed
3 tasks done

Add battery_quantity attribute to battery_type entity #375

nechry opened this issue Jan 5, 2024 · 5 comments · Fixed by #389
Assignees
Labels
enhancement New feature or request

Comments

@nechry
Copy link
Contributor

nechry commented Jan 5, 2024

Checklist

  • I have filled out the template to the best of my ability.
  • This only contains 1 feature request (if you have multiple feature requests, open one feature request for each feature request).
  • This issue is not a duplicate feature request of previous feature requests.

Is your feature request related to a problem? Please describe.

first of all thank you for this integration. I previously built my battery information base using customization (customize.yaml) like this:

sensor.first_floor_landing_motion_sensor_battery_level:
  battery_type: CR123A
sensor.first_floor_landing_smoke_sensor_battery_level:
  battery_type: CR123A
sensor.first_floor_landing_lcd_battery:
  battery_type: LR03/AAA
  quantity: 2
sensor.aqara_opple_switch_2x2_battery:
  battery_type: CR2032
sensor.anemometer_battery:
  battery_type: LR06/AA
sensor.attic_staircase_motion_sensor_battery:
  battery_type: CR2450

This way I added the battery type and quantity to the device's existing battery. You can find more details on my github https://github.com/nechry/ha-battery-inventory

The goal is to reproduce a list of batteries by battery type with the total number of batteries by type and % charge remaining. This is very useful for planning battery ordering.

Describe the solution you'd like

If it would be possible to add the quantity to the battery_type information as an attribute it would be very useful for producing battery reports

Describe alternatives you've considered

it is possible to parse the text sensor with a regex to cut the quantity of the type but I think it would still be cumbersome

Additional context

nothing to add at first but remains available to discuss it

@andrew-codechimp andrew-codechimp added the enhancement New feature or request label Jan 6, 2024
@andrew-codechimp
Copy link
Owner

andrew-codechimp commented Jan 6, 2024

Nice idea, I can add some attributes to split the quantity and type, ironically I'll have to write a regex as well as I have it as one combined string when it is assigned to the device but better to do it in the integration than make everyone do it themselves.

@nechry
Copy link
Contributor Author

nechry commented Jan 6, 2024

great thank for your positive feedback, next step will be to mix information of the battery level with type to reproduce my previous battery remplacement report.

@andrew-codechimp
Copy link
Owner

I have a rough version working with a bit of regex

CleanShot 2024-01-06 at 11 47 44@2x

And yes I always test with Sun & Forecast because they are always in a fresh HA install 😄

@andrew-codechimp andrew-codechimp linked a pull request Jan 6, 2024 that will close this issue
@andrew-codechimp andrew-codechimp self-assigned this Jan 9, 2024
@andrew-codechimp
Copy link
Owner

This is now available in version 1.4.0 which is in pre-release

@nechry
Copy link
Contributor Author

nechry commented Jan 10, 2024

thank-you I will try it soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants