Battery Alarm false trigger

I have a rule to notify me if any of my battery operated devices' battery level drops below 30%.
Here's a screenshot of the trigger:

But I receive notifications when a device reports battery, even if the battery is 87%, or even 100%

What am I doing wrong here ?

I would remove the 'any reports <30' from the trigger and check the battery percentage remaining value into the Actions section instead.
Additionally, some devices lack a populated battery attribute (the value is null); verify how the RM handles this null value.

if I remove the <30 trigger, when(how) will the rule be triggered ?

The rule will be triggered on every device battery reporting.
Then, in the Actions section, add conditional IF statements to generate an alarm or not, depending on your battery level comparison logic.

ok but what is the way to "trigger on every battery report" ?

When value changes

Another way to do this is to use built in "Notifications" app that is native to Hubitat. It is a little simpler than writing your own rule in Rule Machine. If you prefer to use Rule machine follow KKosev's direction and you will be good to go.

Just take note either way though. If you are using Lithium batteries the discharge curve is almost immediate. Regardless what they report out. A lot of times they will be dead before you even have that 30% grace period. Rechargeables are a lot like that. Alkaline are better but still not 100% accurate.

ok. I didn't know that there was a built in notifications app.
I'll use it. RM seems buggy and I didn't understand why I have to put an additional condition after checking battery state change.

I wouldn't go as far as to say that.... there can be some complicated aspects to some automations that may not seem obvious, but that doesn't mean the app itself is "buggy".

I believe the explanation is this: your trigger will be evaluated with any battery report (even one of 100%). Then RM will check the condition, i.e. if any of the devices is <30, and if so, the trigger is fired. In other words, the device causing the evaluation of the trigger is not necessarily the one that satisfies the any condition. You can get around this by having one trigger per device. Agree with @kkossev you’d have to see how those nulls are handled by RM.

In my opinion the best way to check batteries is with the Device Activity Check community app (which can send notifications).

Two very common and relevant points.... Battery monitoring and alerting is a well-worn path around here and activity seems to still be the best measure in most cases (for many battery-powered IoT sensors) for whether a device needs the battery changed. There are some edge-cases where this either doesn't apply or some additional logic is required to better identify a lack of activity, but the approach is still mostly the same, rely on activity rather than battery reporting.

To be clear, Device Activity Check does both.

Good point. I guess I was focussed on what I/we feel is the best measure of the battery having died.... And was not aware DAC offered the battery level monitoring... Good to know.

good points
thank you all.
I'll check DAC
But my main concern is to be able to change the alkaline batteries of my new sonoff water valves in time.
These do not make any activity if you don't send a command.
So DAC might be insufficient (if battery check was not an option)

Some users do subscribe to the option to change batteries for some devices on a defined schedule, based on prior experience, rather than relying on detecting either low battery levels or inactivity.

If you are using alkaline batteries in these devices, presumably AA or AAA, then perhaps you could trial rechargeable batteries and identify a "safe" period to change them?

You may also want to look at whether you can instigate some kind of comm's with the devices, through a configure, refresh or similar command.... The manufacturer / model would be useful to know in this regard.

If they respond to a refresh command, DAC can do this too, ahead of its checks.

it is sonoff , I wrote in my previous post.
Alkaline battery measurement is more reliable as far as I understand from @LearningHubitat 's post.
So I'll stick with alkaline AA batteries and probably battery notification will help with reporting.
But DAC seems good.
I still couldn't understand how I can use both device activity and battery level in DAC though.

I wouldn't prefer to use more battery with additional "refresh" queries.

I'm terrible at absorbing / reading previous posts... :slight_smile: But thanks for providing the detail again...