-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Feature Request: Additional optional entity for the date of the last battery replacement #23
Comments
This is something I want to do as well and will try and get it into a future release. |
I wonder if it is possible to track this automatically? If the battery level rises sharply from a low figure up to close to 100%, this should be possible to detect and store the date automatically. A derived sensor could also use this to predict how long the battery is going to last. |
The automatic tracking of a battery change is a nice idea, I think at the moment my plan is to provide a button/service to set the battery changed date so there will be options to automate it in the future. |
Automatically tracking could certainly be a nice idea, but should you implement it, I think it is best to make it configurable per device. I have some zigbee devices for which the reported battery switches a lot. One moment they report 60%, then they report 30% an hour later, and then a bit later they report 70%... for those devices the automatic tracking would not work. |
Not seen any of mine fluctuate that wildly but noted, I've still got to work out how to store/update/display a date sensor so a long way off :) |
It sounds like the upcoming IoT Battery DB needs a "unreliable" flag. So if it is a device with a known issue about reporting correct battery level, they can by default can have the automatic tracking disabled. |
This is complicated, i have a set of zigbee devices bought on the same batch from the same vendor, type and brand which one behaves weird and the others as you would expect, one reports 17% battery despite the battery being new and working perfectly (i have tried replacing it) and the others 100% with new batteries and slowly declining. So i guess either adding a switch for the automatic change detection or making it fully manual would be required. I also have some bluetooth devices that vary wildly the battery level, which is strange, the mi flora ones |
I've had the same experience as those above, some ZigBee devices will accurately report battery changes while others will fluctuate up and down, even for the same device model and manufacturer. One reason I started looking for a last battery changed add-on originally was to make a better judgement of whether the battery level shown is actually accurate and needs to be changed or just a false alarm. |
It's a bit sad if all the good devices can not have this functionality due to the bad ones. But if it is too common with bad devices, then this needs to be handled somehow. One idea I had was to use the "Notification" system in HA. If a battery is detected to have increased the charge from below e.g. 30% to above e.g. 90%, then a notification pops up saying "It seems like you have changed battery in device XXX? What do you want to do: [Mark battery as replaced] [Mark the battery level as unreliable on this device] [Ignore]" |
This is great ! I came here (after reading this thread https://community.home-assistant.io/t/is-there-a-way-to-add-a-last-battery-change-custom-attribute-to-all-devices-with-a-battery/637570) exactly for this. I need a way to store the history of battery change. I don't care having to set the date or push a button as, as of now, hopefully, I do not change batteries daily ;-) In my user experience, keeping an history of battery changes is a must. Knowing the battery type is a plus ;-) I second other feedback. Many of my zigbee sensors report crazy battery levels and some change up and down for no reason. For the time being, I change the battery of a device when it stops working. Thank you in advance ! |
@hilsonp I really like the idea of having a history of battery changes. I guess the normal HA log is purged too frequently in this regard, since battery changes are (ideally) months or years apart, so a separate system is likely needed. |
Or maybe, instead of storing the date(s) of last change, the number of seconds (or minutes or hours or days) since last change could be stored in a sensor with a state_class set. This way, it is kept in the long terms statistics without anything to be done by the user. |
I am actively working on this at the moment, I'm going with HA's custom storage components to store the value, it seems the most reliable for long term storage of a value. Battery Notes isn't like a typical sensor as there's no retrieving a value from an API or anything so examples to follow for doing this are thin on the ground but pretty sure I'm on the right track now after a few false starts. |
A Beta version has now been released with the both Battery Last Replaced sensor, button & service plus the device picker when manually adding now only shows devices with batteries (can be changed, see FAQ). If you wish to try this version please go into HACS, select Battery Notes and in the top right menu choose Redownload, switch on Show Beta Versions and select the latest version (starts with 1.3) |
Hey @andrew-codechimp, thanks for that integration. Finally a good way of keeping track of the usage of the batteries. However I tried both the 1.2.0 and beta 1.3.0 and both do not work for me. 1.2.0 states an error after adding a new device. I tend to create a bug for this to keep track of this, unless you say that’s a known thing and I should not bother you with this :) |
Hi @we5 did you add battery_notes: to your configuration.yaml and restart? |
I am so sorry @andrew-codechimp, I misread that and assumed this is only for manual installations as i normally never add any configuration manually to the configuration. Works flawlessly. I will now add some of the devices I own to your list. I mainly have Z-Wave devices and especially the TRVs are interesting to monitor more detailed. |
I've installed the beta version 1.3.0 and it's working perfectly, thanks a lot for adding this. |
I did exactly the same. |
This is required for initial discovery, I can't remove it or automate it but I'll make it more obvious and handle it better. |
Hey guys! This is a great addition generally speaking... but I personally can't see the use case. It would be great if you considered adding a config option to disable this feature (I am fine with enabled by default). |
Pretty sure I can make a config option to hide the sensor/button, I've created a new issue to track that. |
Checklist
Is your feature request related to a problem? Please describe.
No way to keep track of when a battery is replaced against the device in HA
Describe the solution you'd like
Suggestion: Optionally add a second entity to go alongside the battery type, where the user can define the date of the last time the battery was replaced as a date selector field (similar to the date helper).
Describe alternatives you've considered
I tried setting up helpers, but not having the helper entity added to the device made it difficult to keep track of everything.
I also tried setting the 'Battery type' entity from this integration to the battery type followed by the last change date, but doing this don't get the history of the changes you would get from a date entity.
Additional context
Keeping track of when batteries are changed can be a bit of a nightmare when you have a lot of devices, being able to record the last time a battery was changed helps identify devices that are draining battery's too fast and how many replacement batteries needed per year etc.
The text was updated successfully, but these errors were encountered: