# Get a warning when any device has low battery?

**URL:** <https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280>\
**Category:** Flows\
**Created:** [September 27, 2021, 1:51pm UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280 "2021-09-27T13:51:57Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [September 28, 2024, 12:45pm UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/21 "2024-09-28T12:45:58Z")

</div>

Homey will inform you automatically, when the capacity of a battery will become less than 20 %. You can choose if you want to be informed in the timeline and/or via push notification. Make sure that the **Energy** notifications are enabled: _ **Homepage → Timeline → … → Energy** _  
So this feature exists.

But of course it’s also possible via flow(s).  
The _ **When…** _ flow card can be found here: _**When… → Home → Cards → (Sensor) of any device changed**_.  
_**(Sensor)**_ is a drop down field where you have to choose _ **Battery** _.

To ensure that the correct tags (device, sensor, value, zone) can be selected in the timeline notification, the previous flow cards must already be connected to each other. If you click on the tag symbol in the text field, then the relevant tags can be chosen:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/2/e/2e922d7cfc2dabba023685d436c1eec9e0ac01d3.png)

---

<div class="post-metadata">

**Author:** ![Olivier\_Arthus](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/olivier_arthus/32/88909_2.png) [@Olivier\_Arthus](https://community.homey.app/u/Olivier_Arthus)\
**Post date:** [September 28, 2024, 1:38pm UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/22 "2024-09-28T13:38:24Z")

</div>

Thank you both for your help.

I had no idea this was a standard feature of Homey. I think this is a good example of where the Homey team should put more efforts, it’s difficult to locate such information (lack of real user guide / tutorials covering most basic features, although there are some good tutorials from the Homey team, but some basics seem to be left out)

I cannot find how to activate notification for low battery.

Here is what I see under Timeline (chronologie in French", no “ENERGY” under timeline

 ![IMG_1167](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/4/84e97c08bf8fefcd17cfe7d3cf892a7a5621d1b3.png)

I also tried this scrren, but still no ENERGY section…

 ![IMG_1166](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/7/172a9ebca288c845acd42acfacaecc1cd2bed207.png)

Regarding the flow itself, thank to your explanation, I found the “battery of any device changed” CARD, thanks

Regarding the second part I see you are showing advanced flow, this is probably why I was not able to achieve it. I need to take some time to understand advanced flows, i have not tried yet

Thanks a lot

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [September 28, 2024, 2:13pm UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/23 "2024-09-28T14:13:46Z")

</div>

Hm, strange! I know that some timeline categories are only available once a first timeline notification has been sent. Unfortunately, I cannot answer whether this is also the case with the energy category, sorry. Maybe someone else knows more about this.

With a normal flows it’s more or less the same way:

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

However, it’s also important here that the previous flow cards are already available.  
If you insert first the timeline notification flow card, then alls the relevant tags are missing:

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/7/870619c522673846c7639633aa2d2602d45fae20.png)

---

<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 28, 2024, 3:27pm UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/24 "2024-09-28T15:27:49Z")

</div>

> [@DirkG](#):
>
> I know that some timeline categories are only available once a first timeline notification has been sent. Unfortunately, I cannot answer whether this is also the case with the energy category, sorry. Maybe someone else knows more about this.

This is indeed the case.  
I get a battery notification from Homey via the energy module if the level falls below 15% (apparently that is the internal threshold). Only after the first notification that timeline category became available.

---

<div class="post-metadata">

**Author:** ![Olivier\_Arthus](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/olivier_arthus/32/88909_2.png) [@Olivier\_Arthus](https://community.homey.app/u/Olivier_Arthus)\
**Post date:** [September 29, 2024, 4:11pm UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/25 "2024-09-29T16:11:58Z")

</div>

ok pretty, clear, but will I ever receive a notification if I have not activated it?  
I hope by default the notifications are active, although i would never be able to set if to active 🙂  
Thanks

---

<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 29, 2024, 5:31pm UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/26 "2024-09-29T17:31:18Z")

</div>

By default Homey will put a notification on its timeline. In addition you have the option to enable a push notification. That will only be send to the user that is the owner of Homey.

You can enable the push notification in the Homey app by going to the tab with the three dots (bottom right) \> Settings \> Timeline \> Energy. There you’ll find a toggle to enable push notifications.

The Energy settings might not be available until after your first energy timeline notification. A timeline notification looks like this (sorry, it’s in Dutch - it say that the battery of a device is almost empty - but you get the picture I hope):

 ![IMG_1527](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/5/c58b97fc61ea6d18e0d209daf58ce345c118a259.jpeg)

---

<div class="post-metadata">

**Author:** ![Olivier\_Arthus](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/olivier_arthus/32/88909_2.png) [@Olivier\_Arthus](https://community.homey.app/u/Olivier_Arthus)\
**Post date:** [September 30, 2024, 6:19am UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/27 "2024-09-30T06:19:11Z")

</div>

thanks, I get the picture indeed, I’ll wait for the first notification  
Have a great day

Olivier

---

<div class="post-metadata">

**Author:** ![Lane\_Canada](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/lane_canada/32/92195_2.png) [@Lane\_Canada](https://community.homey.app/u/Lane_Canada)\
**Post date:** [October 2, 2024, 9:13pm UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/28 "2024-10-02T21:13:28Z")

</div>

What about HomeyScript? Is it any good on the Homey?

---

<div class="post-metadata">

**Author:** ![Lane\_Canada](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/lane_canada/32/92195_2.png) [@Lane\_Canada](https://community.homey.app/u/Lane_Canada)\
**Post date:** [October 3, 2024, 1:24am UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/29 "2024-10-03T01:24:32Z")

</div>

Forget it… I guess HomeyScript can’t send notifications or email… hmmm

---

<div class="post-metadata">

**Author:** ![Cuprum](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/cuprum/32/41409_2.png) [@Cuprum](https://community.homey.app/u/Cuprum)\
**Post date:** [October 3, 2024, 5:20am UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/30 "2024-10-03T05:20:16Z")

</div>

Even if script can not - then the script output can be used from flow 😉

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

Message sending tested on animals 🤭

---

<div class="post-metadata">

**Author:** ![Lane\_Canada](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/lane_canada/32/92195_2.png) [@Lane\_Canada](https://community.homey.app/u/Lane_Canada)\
**Post date:** [October 3, 2024, 11:38am UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/31 "2024-10-03T11:38:02Z")

</div>

Funny you should mention that… I was JUST trying to do that. I have a flow called “Low Battery Notification” and it is triggered when I run my script but I was trying to pass the device(s) back and I am not seeing how you do that. I guess it does not have to pass device(s) names and could just send message “Low Battery” then you could go check what is low.

You have to replace to try this

Here is my flow

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

Here is the code:

```auto
// Get all devices
const devices = await Homey.devices.getDevices();

// Initialize an array to hold devices with low battery
let lowBatteryDevices = [];

// Set your battery threshold
const batteryThreshold = 20; // Change this value as needed

// Iterate over each device
for (let deviceId in devices) {
  let device = devices[deviceId];
  
  // Check if the device has a battery capability
  if (device.capabilities.includes('measure_battery')) {
    // Get battery level
    let batteryLevel = device.capabilitiesObj.measure_battery.value;
    
    // Debugging output
    console.log(`${device.name}: ${batteryLevel}%`);

    // Check if battery level is less than the threshold
    if (batteryLevel !== null && batteryLevel < batteryThreshold) {
      lowBatteryDevices.push(`${device.name}: ${batteryLevel}%`);
    }
  }
}

// If there are any devices with low battery, send a webhook
if (lowBatteryDevices.length > 0) {
  // Build the message with device names and battery levels
  let message = 'Low Battery Alert:\n' + lowBatteryDevices.join('\n');

  // Send a webhook to the flow you created
  const webhookEvent = 'low_battery_alert';
  const webhookUrl = `https://webhook.homey.app/<your id here>/${webhookEvent}`;

  // Send the webhook using fetch
  try {
    const response = await fetch(webhookUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ message, devices: lowBatteryDevices })
    });

    // Log the response to check for any errors
    const responseText = await response.text();
    console.log('Webhook sent. Response:', responseText);
  } catch (error) {
    console.error('Error sending webhook:', error);
  }
} else {
  console.log('No devices with low battery levels found.');
}

```

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [October 3, 2024, 11:58am UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/32 "2024-10-03T11:58:18Z")

</div>

What is the advantage of solving this via a script and WebHooks?  
Not to mention that another app, the HomeyScript app, is required.  
I’m asking out of interest, not because I want to criticize your solution.

---

<div class="post-metadata">

**Author:** ![Lane\_Canada](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/lane_canada/32/92195_2.png) [@Lane\_Canada](https://community.homey.app/u/Lane_Canada)\
**Post date:** [October 3, 2024, 12:13pm UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/33 "2024-10-03T12:13:50Z")

</div>

The idea is to get notification that a battery is low. I am guilty myself of not knowing and wondering why one of my shades did not open. When I look in Homey, I see that the battery is dead. I also will admit, I never looked around to see if there were apps to do this because I would rather keep the number of apps to a min. The other reason is that I just wanted to play with HomeyScript and see how it worked. Honestly it is flakey… that script ran and worked last night, today it doesn’t do anything.

This morning I uninstalled HomeyScript and am just using flow cards to send notification when battery drops below 20%… was fun while it lasted 🙂

---

<div class="post-metadata">

**Author:** ![DirkG](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/dirkg/32/118897_2.png) [@DirkG](https://community.homey.app/u/DirkG)\
**Post date:** [October 3, 2024, 12:37pm UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/34 "2024-10-03T12:37:35Z")

</div>

Ok, understand.

Maybe you didn’t read the whole thread, but the flow I posted in post [#21](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/21) does exactly the same thing as your script. You can set the notification threshold yourself and will get a notification about the device name, the zone and the current charge state in percent. And no additional app is needed.  
Just a hint.

---

<div class="post-metadata">

**Author:** ![Lane\_Canada](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/lane_canada/32/92195_2.png) [@Lane\_Canada](https://community.homey.app/u/Lane_Canada)\
**Post date:** [October 3, 2024, 12:42pm UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/35 "2024-10-03T12:42:39Z")

</div>

lol… no, I did not read the whole thread. Your flow is better than the script for sure. I am going to try and implement it, sounds great. Thanks!

---

<div class="post-metadata">

**Author:** ![Lane\_Canada](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/lane_canada/32/92195_2.png) [@Lane\_Canada](https://community.homey.app/u/Lane_Canada)\
**Post date:** [October 3, 2024, 12:52pm UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/36 "2024-10-03T12:52:10Z")

</div>

MUCH EASIER 🙂 Thank you @DirkG

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/1/e/1ee4b9dbd0a181c426d6fc67b101546dfadf2d97.png)

---

<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:** [October 3, 2024, 1:25pm UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/37 "2024-10-03T13:25:19Z")

</div>

Just another tip, should you run into the following situation.

The above flow might trigger multiple notifications a day for the same device. Especially when the battery level hovers around the threshold.

I use a boolean variable (per device) that indicates whether a notification has been sent that day. That variable is reset at the start of each new day.

The result is that each device notifies me only once a day in case of a low battery.

---

<div class="post-metadata">

**Author:** ![olenesset](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/olenesset/32/120176_2.png) [@olenesset](https://community.homey.app/u/olenesset)\
**Post date:** [December 15, 2024, 4:22pm UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/38 "2024-12-15T16:22:54Z")

</div>

Thanks a lot for sharing!

---

<div class="post-metadata">

**Author:** ![Franq](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/franq/32/81358_2.png) [@Franq](https://community.homey.app/u/Franq)\
**Post date:** [January 25, 2025, 11:19am UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/39 "2025-01-25T11:19:42Z")

</div>

Is it possible to exclude a device from the build in warnings when battery is low? I added my hybrid car and I get warnings when the battery is low. I want to exclude this car from the warnings.

---

<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:** [January 25, 2025, 11:52am UTC](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280/40 "2025-01-25T11:52:50Z")

</div>

AFAIK no. Maybe the app developer can add code to exclude it from reporting as device battery, because it’s a car battery.  
I also would like to recommend to report to Athom homey.app/support, because for users, it should be possible to exclude home- & car batteries and the like, from the default low battery warning system.

For my vacuum cleaner, I ended up with using Timeline Wrangler script, to remove low battery warnings on the minute they’re sent:

> [@\[HomeyScript\] Timeline Wrangler](https://community.homey.app/t/homeyscript-timeline-wrangler/90714/5):
>
> Some flow ideas if you like. Auto remove certain ‘Low Battery’ notifications by Homey, most of the time annoying and useless when a device uses rechargable batteries, like robo mowers, and robo vacs This flow is triggered by new timeline notifications, If it matches the phrase you enter as argument to this Homeyscript card, (find the used script below) in this example: \*\*My\_Mower\*\* is low on battery (an exact part of the original message in the Timelin…

[Previous page](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280.md?page=1)

[Next page](https://community.homey.app/t/get-a-warning-when-any-device-has-low-battery/52280.md?page=3)
