# Battery checker

**URL:** <https://community.homey.app/t/battery-checker/142525>\
**Category:** Devices\
**Tags:** homeyscript\
**Created:** [September 2, 2025, 4:51pm UTC](https://community.homey.app/t/battery-checker/142525 "2025-09-02T16:51:02Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Meggi](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/meggi/32/112663_2.png) [@Meggi](https://community.homey.app/u/Meggi)\
**Post date:** [September 2, 2025, 4:51pm UTC](https://community.homey.app/t/battery-checker/142525/1 "2025-09-02T16:51:02Z")

</div>

Here is a homey script that automatically goes in and finds the devices that are using battery and will give you a push notification on your mobile, with the name(s) of the device and how many % are left on the battery.

You can choose in the script how many % the battery must be below before you get a notification. Line 9 - (battery \<= 20; // Here you can change %) It is set to 20%.

Remember to run the script before you create a flow, as then ”tags” will be created

Remember to install ”HOMEY SCRIPT”

Flow: My check once a day: AT 6:00 PM

 ![Skærmbillede 2025-09-02 183137](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/4/245f771cfb06f206def4a7375e772e594922b5e5.png)

```auto
If I don't answer any questions, it's because I'm sick.
But I hope you can figure it out.

It was me and AI who made this script. 😁

Here is the script:

// Get all devices and filter for those with a battery
let batteryDevices = Object.values(await Homey.devices.getDevices()).filter(device =>
  device.capabilities.includes('measure_battery')
);

// Find all devices with a battery level of 10% or less
let lowBatteryDevices = batteryDevices.filter(device => {
  let battery = device.capabilitiesObj.measure_battery.value;
  return battery !== null && battery <= 20; // Here you can change %
});

// Prepare the notification message
let message;
if (lowBatteryDevices.length === 0) {
  // If all devices are OK, the message is an empty string
  message = '';
} else {
  // Otherwise, create a clear list of devices with low battery
  message = 'Low Battery Alert:';
  lowBatteryDevices.forEach(device => {
    let battery = device.capabilitiesObj.measure_battery.value;
    message += `\n${device.name}: ${battery}%`;
  });
}

// Create a flow tag for the message
await tag('low_battery', message);

// This return value is for confirmation and is not used in the flow
return 'Script executed successfully and created the "low_battery" tag.';

```

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [September 2, 2025, 5:47pm UTC](https://community.homey.app/t/battery-checker/142525/2 "2025-09-02T17:47:58Z")

</div>

Besides using Hscript there’s an onboard solution as well:

 ![Screenshot_20250902_194631_Firefox](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/e/d/ed737a859230ca1e6dedb310c48de5ee8eba191e.jpeg)

---

<div class="post-metadata">

**Author:** ![SunBeech](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sunbeech/32/111391_2.png) [@SunBeech](https://community.homey.app/u/SunBeech)\
**Post date:** [September 2, 2025, 7:36pm UTC](https://community.homey.app/t/battery-checker/142525/3 "2025-09-02T19:36:25Z")

</div>

@Peter_Kawa Very interesting! I currently have separate flows per battery device to monitor and inform me of a (custom) threshold. This flowcard would allow me to replace them with one flow. Do you know since when this flowcard has been made available? I haven’t seen it before.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [September 2, 2025, 9:36pm UTC](https://community.homey.app/t/battery-checker/142525/4 "2025-09-02T21:36:54Z")

</div>

Owww, for me it’s been there since I bought my 1st Pro 2019 back in 2020.

BTW (maybe you knew alr) Homey automatically notifies you when a battery is below 20%, but it’s sent to the timeline only (or with push notifications as well if you have it enabled).

However, there’s this trigger card “when notification was sent”;  
with a logic AND card “contains battery” you can send the notification to “anywhere”.

---

<div class="post-metadata">

**Author:** ![SunBeech](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/sunbeech/32/111391_2.png) [@SunBeech](https://community.homey.app/u/SunBeech)\
**Post date:** [September 3, 2025, 5:25am UTC](https://community.homey.app/t/battery-checker/142525/5 "2025-09-03T05:25:59Z")

</div>

Thanks. I must have completely missed that card then 😊 .

---

<div class="post-metadata">

**Author:** ![N1ghtmar3](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/n1ghtmar3/32/78952_2.png) [@N1ghtmar3](https://community.homey.app/u/N1ghtmar3)\
**Post date:** [September 12, 2025, 6:24am UTC](https://community.homey.app/t/battery-checker/142525/6 "2025-09-12T06:24:42Z")

</div>

Hey,

is it possible to exclude certain devices for this flow? I have a Battery for my solar power use and now i get every day a notification for that

---

<div class="post-metadata">

**Author:** ![Meggi](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/meggi/32/112663_2.png) [@Meggi](https://community.homey.app/u/Meggi)\
**Post date:** [September 12, 2025, 7:10am UTC](https://community.homey.app/t/battery-checker/142525/7 "2025-09-12T07:10:48Z")

</div>

Try this 🙂

```auto
// Get all devices and filter for those with a battery
let batteryDevices = Object.values(await Homey.devices.getDevices()).filter(device =>
  device.capabilities.includes('measure_battery')
);

// Filter out specific devices by name
let filteredDevices = batteryDevices.filter(device => {
  // Replace 'Name of your device' with the exact name you want to exclude
  return device.name !== 'Name on your device';
});

// Find all devices with a battery level of 10% or less from the filtered list
let lowBatteryDevices = filteredDevices.filter(device => {
  let battery = device.capabilitiesObj.measure_battery.value;
  return battery !== null && battery <= 10;
});

// Prepare the notification message
let message;
if (lowBatteryDevices.length === 0) {
  // If all devices are OK, the message is an empty string
  message = '';
} else {
  // Otherwise, create a clear list of devices with low battery
  message = 'Low Battery Alert:';
  lowBatteryDevices.forEach(device => {
    let battery = device.capabilitiesObj.measure_battery.value;
    message += `\n${device.name}: ${battery}%`;
  });
}

// Create a flow tag for the message
await tag('low_battery', message);

// This return value is for confirmation and is not used in the flow
return 'Script executed successfully and created the "low_battery" tag.';

And if you need more devices to eksklude, then use the &&

return device.name !== 'Enhed 1' && device.name !== 'Enhed 2';

Meggi

```

---

<div class="post-metadata">

**Author:** ![N1ghtmar3](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/n1ghtmar3/32/78952_2.png) [@N1ghtmar3](https://community.homey.app/u/N1ghtmar3)\
**Post date:** [September 12, 2025, 7:27am UTC](https://community.homey.app/t/battery-checker/142525/8 "2025-09-12T07:27:23Z")

</div>

Hey thanks for your idea but honestly spoken i do not have any clue how it works with home script. Is there also any solution with flow cards? Maybe to compare result tag “#Device” Name with Name of solar power battery.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/9/f/9f3c80738b94f014a5d5c903ae9dbd59262a2330.png)

Will it work like this?

---

<div class="post-metadata">

**Author:** ![Meggi](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/meggi/32/112663_2.png) [@Meggi](https://community.homey.app/u/Meggi)\
**Post date:** [September 12, 2025, 10:15am UTC](https://community.homey.app/t/battery-checker/142525/9 "2025-09-12T10:15:37Z")

</div>

Kan you translate your flow into english, just write whats in each “box”.

I check later, i’m going to the hospital today, so please be patient, as it can take a couple of days.

Meggi

---

<div class="post-metadata">

**Author:** ![N1ghtmar3](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/n1ghtmar3/32/78952_2.png) [@N1ghtmar3](https://community.homey.app/u/N1ghtmar3)\
**Post date:** [September 12, 2025, 11:27am UTC](https://community.homey.app/t/battery-checker/142525/10 "2025-09-12T11:27:33Z")

</div>

Battery of any device changed → @Device consists not of: solar\_p1uze → #Value is lower than 15 → Push Notification

---

<div class="post-metadata">

**Author:** ![N1ghtmar3](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/n1ghtmar3/32/78952_2.png) [@N1ghtmar3](https://community.homey.app/u/N1ghtmar3)\
**Post date:** [September 15, 2025, 9:59am UTC](https://community.homey.app/t/battery-checker/142525/11 "2025-09-15T09:59:31Z")

</div>

It worked fine. So for everybody, who wants to exclude certain devices, this is a solution

---

<div class="post-metadata">

**Author:** ![Meggi](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/meggi/32/112663_2.png) [@Meggi](https://community.homey.app/u/Meggi)\
**Post date:** [September 16, 2025, 8:04am UTC](https://community.homey.app/t/battery-checker/142525/12 "2025-09-16T08:04:40Z")

</div>

Hi

I’m back.

I see you got it working, so that’s great. 😀

Meggi
