# Global battery monitoring

**URL:** <https://community.homey.app/t/global-battery-monitoring/48043>\
**Category:** Questions & Help\
**Created:** [June 1, 2021, 8:54pm UTC](https://community.homey.app/t/global-battery-monitoring/48043 "2021-06-01T20:54:01Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![John\_Lesage](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/john_lesage/32/16576_2.png) [@John\_Lesage](https://community.homey.app/u/John_Lesage)\
**Post date:** [August 29, 2023, 1:08pm UTC](https://community.homey.app/t/global-battery-monitoring/48043/10 "2023-08-29T13:08:04Z")

</div>

> [@The Flow Exchange(r) - Exchange Your Flows with Others!](https://community.homey.app/t/the-flow-exchange-r-exchange-your-flows-with-others/68981/36):
>
> ```auto
> // battery-report
> let array = [];
> 
> const devices = await Homey.devices.getDevices({ filter: {capabilities: 'measure_battery'} });
> _.forEach(devices, device => {
> array.push( device.name + ': \n' + device.capabilitiesObj?.measure_battery.value + '%' );
> });
> 
> //oldest date on top sort array = ["time_stamp device", "time_stamp device", "time_stamp device"]
> const array_sorted = array.slice().sort(function(time_stamp, device) { 
> const firsttime_stamp = time_stamp.split(" ")[0];
> const secondtime_stamp = device.split(" ")[0];
> if(firsttime_stamp < secondtime_stamp) return -1;
> if(firsttime_stamp > secondtime_stamp) return 1;
> return 0;
> });
> 
> return("Battery levels:\n" + array_sorted.join('\n') + "\n");
> 
> ```

Hi Peter,

Thanks, this works perfectly for me!

---

_[View the full topic](https://community.homey.app/t/global-battery-monitoring/48043)._
