I wanted a way to predict how long until the Ring ran out of battery. After some research, I found you can find the slope of the battery using a Statistics sensor, and predict it using a template. Here’s the code.
My Ring went offline when the battery read 21%. I get notified when any batteries are less than 35% but I have a set of door sensors that go off line when less than 85% (I have a separate notification for these). I would probably adapt your solution to account for a target different than zero.
Have you tested actual days to zero battery vs estimated?
I just set it up today, so I haven’t tested it. But remember, the math is just battery / battery loss per day. You could use a fixed value instead if you want.
I’ve been using something similar for a few of my batteries. How has this been working out for you?
I’m looking to try to determine a more general solution. It seems like the right value for the max_age (or sampling_size) can vary a lot between devices. For example, a slowly discharging battery with a max_age of 48 hours might be too small of a value.