Fixed my driver || Possible bug with notification app with battery string as decimal

@gopher.ny I have some drivers that are sending battery values as decimals it seems. This is breaking the the notifications which probably is expecting an integer as the battery %.
Thanks for looking.

app:33452021-05-11 10:22:24.198 am errorjava.lang.NumberFormatException: For input string: "72.5" on line 419 (batteryHandler)

Sounds like @bravenel's new favorite problem. :wink: What drivers are the offending devices using? If they are built-in, my guess is that staff will "fix"/modify them to report integer values. If they are custom, I'd suggest the author do the same (the docs aren't more specific than "number" here, as is usually the case, but I can't imagine anyone would want a decimal value for battery), though a modification of the Notifications app to work around this issue would also be possible.

2 Likes

It seems inevitable that all built-in apps are going to stop worrying about decimals in events.

2 Likes

Didn't get the context/meaning of the comment, english not my native language.

Markus is no longer maintaining these drivers on Hubitat I guess.
I am doing a best effort, as I am not a coder/programmer, but Hubitat user/customer, a script kiddie, code monkey who enjoys tinkering.

As I gather from the above is up to myself to fix then.

1 Like

No, sounds like Bruce will modify the Notifications app to handle this (even though it might be better to modify the driver to report integers, too, in case this confuses any other apps that don't expect decimal values here).

1 Like

yeah, thanks for your help.

For your reference:
bat = bat.toInteger()

Convert String to Integer in Groovy | Baeldung

1 Like

Notifications app fixed to not throw error on decimal values in events. This will be in a hot fix release tomorrow.

1 Like

Thank you good sir. I appreciate the haste and your kind attention.