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

Default battery last replaced and last seen dates #2193

Open
3 tasks done
andrew-codechimp opened this issue Oct 6, 2024 · 2 comments
Open
3 tasks done

Default battery last replaced and last seen dates #2193

andrew-codechimp opened this issue Oct 6, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@andrew-codechimp
Copy link
Owner

andrew-codechimp commented Oct 6, 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.

Rather than unknown set the battery replaced date to a sensible default

Describe the solution you'd like

Is date-created available in the HA device registry? If so, would it be possible to write a one-time thing to go thru all devices in Battery Notes, and set “Battery last replaced” on any device having null / Unknown value, to the date that the device was added to HA? --Could be useful to provide a decent approximation of how old some of the batteries are.

When adding a battery note to a device also default the last seen to now, so that the device not reported event will fire for devices that are already unknown.

Describe alternatives you've considered

N/A

Additional context

Date created/modified was added to HA 2024.8, when Battery Notes min version reaches that investigate if those dates can be accessed via the device

@andrew-codechimp andrew-codechimp self-assigned this Oct 6, 2024
@andrew-codechimp andrew-codechimp added the enhancement New feature or request label Oct 6, 2024
@oblivioncth
Copy link

oblivioncth commented Oct 15, 2024

I apologize if this is documented somewhere, but I found this issue and figured it wouldn't hurt to ask here since it seems contextually relevant.

I just setup the integration and some related automations (based on the community ones in the docs). Two of my devices show the last reported date as "Unknown" as they've been dead for some time, so Battery Notes never had a chance to mark a date.

When running the heartbeat check:

data:
  days_last_reported: 2
action: battery_notes.check_battery_last_reported

it seems that battery_notes_battery_not_reported events are not created for these devices.

Just curious if that is part of the motivation for this issue (i.e. ensuring that all devices have a reported date one way or another so that this action always has something to compare to)? I imagine alternatively you could have devices with an "Unknown" report date always trigger an event, unless that's undesirable in case for one reason or another it's only "Unknown" temporarily.

I figured it would be prudent to report this minor "oversight" in case that isn't what this issue is about.

Of course in my particular case I can just force the values to some arbitrary date in the past using the developer tools in order to test my notifications :)

EDIT: Ok well doing the above didn't work, so now I'm not totally sure what the culprit is. I made a discussion in regards to this, sorry for the noise.

@andrew-codechimp
Copy link
Owner Author

A fuller description is in the discussion #2223 but when creating the default last replaced data also add a default last seen.

@andrew-codechimp andrew-codechimp changed the title Default battery last replaced date to device created date Default battery last replaced and last seen dates Oct 16, 2024
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

No branches or pull requests

2 participants