[APP][Pro] Device Capabilities - Enhance the capabilities of devices

Hm, not using when Listen (Watch) trigger at all, only using When Device Capability is… so far seems there is improvement indeed.

6 hours view

1 hour view - DC would be killed probably only 1 time

FYI, I parsed old SQLIte DB data from Homey, seems when speaking about “homey:app:nl.qluster-it.DeviceCapabilities:trigger_capability_hasbeen” I found about 75 flows … :smiling_face_with_tear:

And I like that so much compared to Athom’s built in “When SOMETHING becomes less / more then…”

update in the morning

  • for some reason since 5AM the usage goes above 140MB again more often ;-(

In my case, my Homey was auto updated to a new firmware version (12.4.8-rc4) around that time. May the same happened in your case? And could that cause a (temporary) increase?

Not in my case, unfortunately, the app is running nonstop since my last report.

Well, i enjoy the fact that you like and use that card so much. But i guess we do now know why your resources are running high :face_with_hand_over_mouth:.

Only way to reduces the resources would be, to create a simular flowcard, but instead of select a device and capability, use a tag as input. Ofc that would make it more complicated to use, and a homey reboot would lose its info.
So yeah, im still thinking about solutions, but cant think of anything realistic.

I was kinda hoping the newest homey-api would use less resources, but instead, its still more heavy then the athom-api (the old one).

N.b. please note that listing to a device is heavy, but if you have f.i. 4 flowcards listening to the same capability of the same device, that does not increase resource usage in comparison to one flowcard listening to the same.

2 Likes

Thank you, I really appreciate ! But is it really just me doing this so often, it’s pretty useful function, overcoming limitation of built-in functionality.I just would like to avoid me doing something stupid, I don’t see many more users reporting the same on regular crashes due to the memory limitations. Eg. why the usage start peaking after some time …anyway, I will start slowly removing it from non-essentials flows, to see if situation actually improves.

1 Like

Jep… but thats the whole point of my apps and in particularly the Device Capabilities app :wink:

If an app could create and manage its own flows, that would create so much posibilities to reduce memory usage. Lets hope there comes a time where that would be allowed :sweat_smile::crossed_fingers:

Edit: also, on my homey, i see that most apps with highest resources, are the ones also reflecting device data, like Button+ and Sharptools.

1 Like

Its weird tho @Sharkys , this is my current usage:
In the app settings:


In Homey Settings Memory:

1 Like

Hi Arie,

The app got (probably) paused by Homey 2019 for most probably exceeding memory threshold
This after a full day of running fine with the new v2.16.0 :man_shrugging:
I’ve sent you a diag for possible interesting info
(4d88111e-d6c7-426c-89c3-5df73b2afceb)

If listeners would be causing too much load:
How can I find flows with listeners?

1 Like

Anything special happend at that time?
Seems so weird that it would suddenly increase such memory usage.

Euhm, im not sure actually.
I guess with editing my Search script a bit, to search for a specific flowcard.

No I didn’t change anything, nothing special today. The memory use was even below 40MB most of the time, which is pretty good (with 2.14.x it went over 50MB’s).

2 Likes

Odd, the app stopped (not crashed) at my test pro 2019 as well. This is not a very busy Homey.
70bc981f-be68-4848-ab17-d70937a479e2

No hurries, I’m back to v2.14.9

Yeah, my 2019 is still down, technically still as backup. Bit since i’ve been running the 2023 for wel over a year, close to two years, i dont think ill switch back (even tho zwave still fails when controlling multiple devices at once).
So i think ill reset that one and use it as test Homey device.

:face_with_monocle:

…it seems for me memory is building up, I guess it was the same also for previous test version.

24 hours

After restart

(in Homey app it shows 136MB and 97.7 MB in Homey memory overview, that correspond to RSS and PSS values)

Will run CLI for debugging purposes, removing some of the When triggers, let’s see.
After all, it that’s all linked with Homey API, we are screwed ;-(

Thanks, i am very curious.
I have put so much time in performance, which is my strongest part as developer, altho i am no node.js expert. Strangely, i have a lot of AVDs using multiple reflections, for myself en for testing and demonstrations/examples.
And the “if capability is x for x time” flowcard i also use quite a lot. So i fail to understand why yours is using so much memory in comparison to me.

Could you give an estimate on how many devices are listened to?
As in, how many unique devices/capabilities do you use in reflect or the two flowcard-listeners?

btw from debugger, quite interesting to me … might provide some perspective.

2025-06-07T20:01:01.686Z [log] [DeviceCapabilities] refreshDevices
[ { id: '646662a0-9cc7-41f1-a84d-f42ed27fe3d6' } ]
ObjectToFind Collect - Start                       - Duration: 127718, Total: 127718
ObjectToFind Collect - Finish                      - Duration: 758, Total: 128477
ObjectToFind Filter - Start                        - Duration: 0, Total: 128481
ObjectToFind Filter - Finish                       - Duration: 5, Total: 128487
Get Flows - Start                                  - Duration: 0, Total: 128488
Get Flows - Finish                                 - Duration: 226, Total: 128714
Get Advanced Flows - Start                         - Duration: 0, Total: 128715
2025-06-07T20:01:02.712Z [log] [DeviceCapabilities] refreshDevices
Get Advanced Flows - Finish                        - Duration: 260, Total: 128976
Remap Flows - Start                                - Duration: 0, Total: 128977
Remap Flows - Finish                               - Duration: 47, Total: 129024
Remap Advanced Flows - Start                       - Duration: 0, Total: 129025
Remap Advanced Flows - Finish                      - Duration: 73, Total: 129098
Combining Flows and Advanced Flows - Start         - Duration: 0, Total: 129099
Combining Flows and Advanced Flows - Finish        - Duration: 2, Total: 129102
Search Objects - Start                             - Duration: 0, Total: 129103
Search Objects - Finish                            - Duration: 0, Total: 129103

How many different devices are listened for changes, not sure that I understand fully but with small AI help :

SELECT COUNT(DISTINCT json_extract(cards.value, '$.args.device.id')) AS listened_devices
FROM Entry
JOIN json_each(json_extract(Entry.value, '$.cards')) AS cards
WHERE Entry.type = 'advancedflow'
  AND json_extract(cards.value, '$.id') = 'homey:app:nl.qluster-it.DeviceCapabilities:trigger_capability_hasbeen'
  AND json_type(cards.value, '$.args.device.id') = 'text'
  AND json_extract(cards.value, '$.args.device.id') IS NOT NULL;

…seems to be around 32 ? … in total 72 triggers (I’m using only WHEN DEVICE VALUE…)

Also, I had to fix some of the flows thanks to running debug :wink: … I guess that shall have no impact but anyway - fixed.

2025-06-07T20:09:02.448Z [err] [DeviceCapabilities] HomeyAPIError: Not Found: Device with ID 646662a0-9cc7-41f1-a84d-f42ed27fe3d6
    at ManagerDatabase.findEntry (file:///app/lib/ManagerDatabase.mjs:32:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Device.findEntry (file:///node_modules/@athombv/homey-core/dist/lib/DatabaseEntry.mjs:203:23) {
  statusCode: 404,
  description: null
}
2025-06-07T20:09:02.457Z [log] [DeviceCapabilities] continueing
2025-06-07T20:09:02.641Z [err] [DeviceCapabilities] HomeyAPIError: Not Found: Device with ID e7056a05-3cf0-4ed9-a169-babdc3603a85
    at ManagerDatabase.findEntry (file:///app/lib/ManagerDatabase.mjs:32:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Device.findEntry (file:///node_modules/@athombv/homey-core/dist/lib/DatabaseEntry.mjs:203:23) {
  statusCode: 404,
  description: null
}
1 Like

No problem, Arie. I understand testing on a Pro 2019 yourself is easier, but please don’t make hasty decisions. v2.14.9 is still a very useful version for me :wink:

1 Like

Yeah im still thinking about a way to log errors so users can see it. F.i. the DC app can now crash when you try to set a boolean (yes/no) capability with a text.
But my logs of errors is huge, mostly because of internal homey-api issues. Partly why i waiting so long to put time in it again, hoping it would have been fixed. But unfortunately it hasn’t.

But i am thinking about just catching all errors and send them to Simple (Sys) Log and ignoring the in DC so it won’t crash the DC app.

2 Likes

I removed most listeners trigger flow cards, and I removed dozens of device reflections in a few AVD’s.

Good news, Arie:
Finally levels are “normal” again
Memory is around 35 - 40 MB’s
System load drastically lowered, it was over 250% most of the time:

So, I installed the v2.16.0 app version this afternoon again :grimacing:, memory usage is not higher than v2.14.9
Now let’s hope it doesn’t get killed by Homey.

1 Like

Bummer, DC app v2.16.0 crashed. It wasn’t paused or frozen. No memory cap issue as it seems, 27 MB is very low for the app (on my Homey that is):

Which homey version do you have install, perhaps i can find the error in the logs.