# Battery issues

**URL:** <https://community.smartthings.com/t/battery-issues/3314>\
**Category:** Devices & Integrations\
**Created:** [July 9, 2014, 8:12pm UTC](https://community.smartthings.com/t/battery-issues/3314 "2014-07-09T20:12:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![beckwith](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/beckwith/32/15130_2.png) [@beckwith](https://community.smartthings.com/u/beckwith)\
**Post date:** [July 9, 2014, 8:12pm UTC](https://community.smartthings.com/t/battery-issues/3314/1 "2014-07-09T20:12:56Z")

</div>

Because of the low power needs of some of these newer devices and the convenience of wireless, it seems more and more devices use batteries. However, I have some observations and concerns.

Not all devices are reporting battery status. I’m not sure if this is a SmartThings issue or the device. How do you go about diagnosing this?

What is the “standard” for a battery alarm. I received a push notification from one device when it reached 10% and another at 1%. And how do we control this delivery. To me low battery is less important than a smoke alarm or water leak. I would rather send it as SMS than push or some other option like e-mail.

With my 54 devices, it gets rather difficult managing which needs its battery changed and when. It would be nice to have a screen that lists all the battery status we can sort.

It wouldn’t be so bad if devices could better handle rechargables because you could just periodically replace with a fully charged battery. Otherwise, with disposables, you want to get your money’s worth so to speak and use it till it is nearly dead.

---

<div class="post-metadata">

**Author:** ![brianlees](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/brianlees/32/267_2.png) [@brianlees](https://community.smartthings.com/u/brianlees)\
**Post date:** [July 9, 2014, 10:14pm UTC](https://community.smartthings.com/t/battery-issues/3314/2 "2014-07-09T22:14:09Z")

</div>

> [@beckwith](#):
>
> It would be nice to have a screen that lists all the battery status we can sort.

+1 on this. This is a great idea.

---

<div class="post-metadata">

**Author:** ![mattjfrank](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/mattjfrank/32/100696_2.png) [@mattjfrank](https://community.smartthings.com/u/mattjfrank)\
**Post date:** [November 13, 2014, 5:27am UTC](https://community.smartthings.com/t/battery-issues/3314/3 "2014-11-13T05:27:43Z")

</div>

Very good idea!!!

---

<div class="post-metadata">

**Author:** ![notoriousbdg](https://avatars.discourse-cdn.com/v4/letter/n/ce7236/32.png) [@notoriousbdg](https://community.smartthings.com/u/notoriousbdg)\
**Post date:** [November 15, 2014, 12:49am UTC](https://community.smartthings.com/t/battery-issues/3314/4 "2014-11-15T00:49:59Z")

</div>

> [@beckwith](#):
>
> With my 54 devices, it gets rather difficult managing which needs its battery changed and when. It would be nice to have a screen that lists all the battery status we can sort.

I created a SmartApp that will show battery levels for all devices on a single screen. It’s not the prettiest view, but you can see everything at once. I have a few ideas to make it cleaner that I’ll try when I have some free time. Check it out at [https://github.com/notoriousbdg/SmartThings.BatteryMonitor](https://github.com/notoriousbdg/SmartThings.BatteryMonitor).

---

<div class="post-metadata">

**Author:** ![mattjfrank](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/mattjfrank/32/100696_2.png) [@mattjfrank](https://community.smartthings.com/u/mattjfrank)\
**Post date:** [November 15, 2014, 2:38am UTC](https://community.smartthings.com/t/battery-issues/3314/5 "2014-11-15T02:38:53Z")

</div>

Nice work! All my devices that report battery are showing up.

---

<div class="post-metadata">

**Author:** ![acastal](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/acastal/32/98947_2.png) [@acastal](https://community.smartthings.com/u/acastal)\
**Post date:** [November 15, 2014, 4:51am UTC](https://community.smartthings.com/t/battery-issues/3314/6 "2014-11-15T04:51:16Z")

</div>

Now if it were possible to merge this with the Dashboard to see battery in the tiles…wow

---

<div class="post-metadata">

**Author:** ![beckwith](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/beckwith/32/15130_2.png) [@beckwith](https://community.smartthings.com/u/beckwith)\
**Post date:** [November 15, 2014, 1:59pm UTC](https://community.smartthings.com/t/battery-issues/3314/7 "2014-11-15T13:59:43Z")

</div>

@notoriousbdg

Great work!

It is nice you can select the desired devices because powered devices with battery options always show 100%. Of my 16 battery devices, one is null, one 100% (but six months old), and one 208%. The one returning “OK” fails on line 117.

Powerful app.

---

<div class="post-metadata">

**Author:** ![notoriousbdg](https://avatars.discourse-cdn.com/v4/letter/n/ce7236/32.png) [@notoriousbdg](https://community.smartthings.com/u/notoriousbdg)\
**Post date:** [November 15, 2014, 2:47pm UTC](https://community.smartthings.com/t/battery-issues/3314/8 "2014-11-15T14:47:29Z")

</div>

> [@acastal](#):
>
> Now if it were possible to merge this with the Dashboard to see battery in the tiles…wow

I wish that was possible too…

> [@beckwith](#):
>
> It is nice you can select the desired devices because powered devices with battery options always show 100%. Of my 16 battery devices, one is null, one 100% (but six months old), and one 208%. The one returning “OK” fails on line 117.

I just uploaded a new version that improves formatting of the status page and moves status to the main page. It seems a lot more readable now and much easier to find the batteries that need attention. The latest version should lump devices that are null, \> 100 or have unknown strings in the battery error section.

Devices with “OK” status should now be included in the battery high section, but I can’t test that myself. Do you know the other states returned by that device? I can force those into the appropriate sections to make them display better.

Do you know what 208 represents? I assume it’s not percentage.

Can you try the latest version at https://github.com/notoriousbdg/SmartThings.BatteryMonitor and let me know if it works better?

---

<div class="post-metadata">

**Author:** ![beckwith](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/beckwith/32/15130_2.png) [@beckwith](https://community.smartthings.com/u/beckwith)\
**Post date:** [November 15, 2014, 3:41pm UTC](https://community.smartthings.com/t/battery-issues/3314/9 "2014-11-15T15:41:31Z")

</div>

> [@notoriousbdg](#):
>
> Devices with “OK” status should now be included in the battery high section, but I can’t test that myself. Do you know the other states returned by that device?

Still fails on OK. I wouldn’t worry about this right now since this is a Nest Protect which I haven’t really tested yet. The code indicates “OK” and “Low” the two values.

> [@notoriousbdg](#):
>
> Do you know what 208 represents?

It is a FortrezZ moisture sensor which must be malfunctioning. Says 208 percent. Another reason this app is important!

I think line 159 should be:

```
    title: "Medium battery threshold?",

```

instead of Low.

New layout is much more useful!

Again, a must have app!

---

<div class="post-metadata">

**Author:** ![beckwith](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/beckwith/32/15130_2.png) [@beckwith](https://community.smartthings.com/u/beckwith)\
**Post date:** [November 15, 2014, 3:53pm UTC](https://community.smartthings.com/t/battery-issues/3314/10 "2014-11-15T15:53:29Z")

</div>

@notoriousbdg

Error for OK is:

java.lang.NumberFormatException @ line 82

---

<div class="post-metadata">

**Author:** ![notoriousbdg](https://avatars.discourse-cdn.com/v4/letter/n/ce7236/32.png) [@notoriousbdg](https://community.smartthings.com/u/notoriousbdg)\
**Post date:** [November 15, 2014, 4:25pm UTC](https://community.smartthings.com/t/battery-issues/3314/11 "2014-11-15T16:25:17Z")

</div>

> [@beckwith](#):
>
> The code indicates “OK” and “Low” the two values.

“Low” should show under the battery low section.

> [@beckwith](#):
>
> I think line 159 should be:
> 
> ```
> title: "Medium battery threshold?",
> 
> ```
> 
> instead of Low.

Fixed.

> [@beckwith](#):
>
> Error for OK is:
> 
> java.lang.NumberFormatException @ line 82

That was leftover code from before I updated the formatting of the status page. I removed that line. Do you mind testing the latest version?

---

<div class="post-metadata">

**Author:** ![notoriousbdg](https://avatars.discourse-cdn.com/v4/letter/n/ce7236/32.png) [@notoriousbdg](https://community.smartthings.com/u/notoriousbdg)\
**Post date:** [November 15, 2014, 5:48pm UTC](https://community.smartthings.com/t/battery-issues/3314/12 "2014-11-15T17:48:33Z")

</div>

Updated again. This time to add notifications.

---

<div class="post-metadata">

**Author:** ![beckwith](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/beckwith/32/15130_2.png) [@beckwith](https://community.smartthings.com/u/beckwith)\
**Post date:** [November 15, 2014, 5:59pm UTC](https://community.smartthings.com/t/battery-issues/3314/13 "2014-11-15T17:59:48Z")

</div>

Still getting error at line 82, but don’t know if same cause. I need to contact support to remove app for me because I get an error when I try.

---

<div class="post-metadata">

**Author:** ![notoriousbdg](https://avatars.discourse-cdn.com/v4/letter/n/ce7236/32.png) [@notoriousbdg](https://community.smartthings.com/u/notoriousbdg)\
**Post date:** [November 15, 2014, 6:10pm UTC](https://community.smartthings.com/t/battery-issues/3314/14 "2014-11-15T18:10:46Z")

</div>

Try removing you nest protect from the devices list to see if it will allow you uninstall. Is the error the same as before?

---

<div class="post-metadata">

**Author:** ![notoriousbdg](https://avatars.discourse-cdn.com/v4/letter/n/ce7236/32.png) [@notoriousbdg](https://community.smartthings.com/u/notoriousbdg)\
**Post date:** [November 15, 2014, 6:13pm UTC](https://community.smartthings.com/t/battery-issues/3314/15 "2014-11-15T18:13:28Z")

</div>

You can also uninstall the app manually from [https://graph.api.smartthings.com/location/list](https://graph.api.smartthings.com/location/list). On that page, click on smartapps, then click edit, then click uninstall beside the BatteryMonitor SmartApp,

---

<div class="post-metadata">

**Author:** ![notoriousbdg](https://avatars.discourse-cdn.com/v4/letter/n/ce7236/32.png) [@notoriousbdg](https://community.smartthings.com/u/notoriousbdg)\
**Post date:** [November 15, 2014, 6:31pm UTC](https://community.smartthings.com/t/battery-issues/3314/16 "2014-11-15T18:31:47Z")

</div>

I looked through the code and I have a suspicion about what’s causing the error with OK. I just checked in a change that should handle strings better.

---

<div class="post-metadata">

**Author:** ![beckwith](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/beckwith/32/15130_2.png) [@beckwith](https://community.smartthings.com/u/beckwith)\
**Post date:** [November 15, 2014, 6:55pm UTC](https://community.smartthings.com/t/battery-issues/3314/17 "2014-11-15T18:55:39Z")

</div>

> [@notoriousbdg](#):
>
> [https://github.com/notoriousbdg/SmartThings.BatteryMonitor](https://github.com/notoriousbdg/SmartThings.BatteryMonitor)

Still get the error at line 82 for the Nest Protect. That device isn’t working anyway…

You need to add the following after line 92 to catch my 208% charged battery:

```
			} else {
				listLevel0 += "$it.currentBattery $it.displayName\n"
			}

```

---

<div class="post-metadata">

**Author:** ![notoriousbdg](https://avatars.discourse-cdn.com/v4/letter/n/ce7236/32.png) [@notoriousbdg](https://community.smartthings.com/u/notoriousbdg)\
**Post date:** [November 15, 2014, 9:27pm UTC](https://community.smartthings.com/t/battery-issues/3314/18 "2014-11-15T21:27:11Z")

</div>

> [@beckwith](#):
>
> You need to add the following after line 92 to catch my 208% charged battery:
> 
> ```
> } else {
> listLevel0 += "$it.currentBattery $it.displayName\n"
> }
> 
> ```

I just checked in that fix and code to handle \< 0 if that happens.

---

<div class="post-metadata">

**Author:** ![notoriousbdg](https://avatars.discourse-cdn.com/v4/letter/n/ce7236/32.png) [@notoriousbdg](https://community.smartthings.com/u/notoriousbdg)\
**Post date:** [November 20, 2014, 4:44pm UTC](https://community.smartthings.com/t/battery-issues/3314/19 "2014-11-20T16:44:46Z")

</div>

> [@beckwith](#):
>
> Still get the error at line 82 for the Nest Protect.

I was able to reproduce the error and I’m pretty confident now that the battery attribute must be an an integer. The SmartApp will group battery statuses that are strings into the error section and it will throw a notification stating that a string was returned. The Nest Protect device type that you’re using needs to be updated to return a number for battery or use a different attribute than battery.

---

<div class="post-metadata">

**Author:** ![beckwith](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/beckwith/32/15130_2.png) [@beckwith](https://community.smartthings.com/u/beckwith)\
**Post date:** [November 20, 2014, 4:53pm UTC](https://community.smartthings.com/t/battery-issues/3314/20 "2014-11-20T16:53:19Z")

</div>

> [@notoriousbdg](#):
>
> The Nest Protect device type that you’re using needs to be updated to return a number for battery or use a different attribute than battery.

Thanks, I figured something like that since I read this in another thread. Sorry if you wasted time on this.

[Next page](https://community.smartthings.com/t/battery-issues/3314.md?page=2)
