[APP][Pro] Flow Checker

I was facing the same, for 1 year and I was told the same - try to optimize flows where you have “when value changes” - then your memory will be fine, replace it eg. by “when value is above/below” or for frequent check replace by “each x minutes”.

But other than that the idea was already mentioned here, it would be helpful as the only way today is probably to hower mouse button on certain flows in the web interface…

1 Like

Hey @Heula ,

Checking if a flow consumes too much would be a bit hard. What might be a option is the request for how many times a flow ran. (see todo point 2)

I didn’t look into that yet as I’m working on other apps at the moment. But will soo n check what I can do.

Flowchecker is already quite memory heavy so I also have to keep that in mind with extra features :slight_smile:

Thanks Martijn.

I can indeed see how many times a flow has run when I hover over the flow in the web app.
That is a total number, I would like to know how many times per hour, per day etc.

I have the idea that it has to do with my presence flows, but I’m not sure yet.

That total number in comparison with rest might indicate already issue. However in my case of was rather related to device updating values eg. very frequently, eg. voltage…
Anyway, you will see. I will stop OT now.

1 Like

Wait what…
I didn’t know that existed! :man_facepalming:


Probably have to revisited @DirkG request again and check what the request is :stuck_out_tongue:


Edit: @DirkG I think you meant you want to have the number of triggers in a token or something like that?

1 Like

No, I want to have the number of how many times a flow was triggered, as mentioned by @Heula.
I guess that the number says how many times the flow was started/triggered, not how many times the flow ran completely through, by the way.

2 Likes

Dunno if you have the scripts alr?
Developer ‘playground’:

Hscript:

// Get Trigger counts for Flows

let myFlowsArr = await Homey.flow.getFlows().then(f => Object.values(f).reduce((r,b)=>Object.assign(r, {[b.name]:b.triggerCount}), {}));

let myFlows = JSON.stringify(myFlowsArr);
console.log ('All flow triggers:' , myFlowsArr); 

// Create / Update Hscript variable 
await tag("FlowTriggers", myFlows);

// // Timeline notification:
// Homey.flow.runFlowCardAction({
// uri: 'homey:manager:notifications',
// id: 'create_notification',
// args: {
// text: 'All flow triggers: ' + myFlows + ' - Direct from script: GetTriggerCountOfFlows.js '
// }
// });

@Peter_Kawa
That could be better :wink:

let flowCards = await Homey.flow.getFlows();
flowCards = Object.values(flowCards).map(f => ({name: f.name, count: f.triggerCount}))
const myFlows = JSON.stringify(flowCards, null, 4);
await tag("FlowTriggers", myFlows);

console.log(myFlows);
2 Likes

@Heula you could use above script and run that every hour. Save it to a file or something like that and compare it later. Then you can find the flows with a lot of triggers.

@DirkG The triggerCount is the amount of times the flows got triggered even when it didn’t succeed. But it’s hard to measure when a flow ran completely. > If the AND part of a flow is false the flow still did run :thinking: (or it executed the ‘else’ part of the flow)

For me the TriggerCount would be perfect.

2 Likes

Thanks Martijn, will do that later today.

1 Like

Not sure if I used the script correctly but I get an error using it.

@Heula It’s a Homey script :slight_smile:

My mistake, I had to install Homeyscript. Success now.
Thank you.

1 Like
  • I wanted the output to be sorted by trigger count :grimacing:
// Get the Trigger count for all flows, sorted by trigger count

Array.prototype.sortBy = function(p) {
  return this.slice(0).sort(function(a,b) {
    //// Sort ascending
//    return (a[p] > b[p]) ? 1 : (a[p] < b[p]) ? -1 : 0;
    // Sort descending
    return (b[p] > a[p]) ? 1 : (b[p] < a[p]) ? -1 : 0;
    });
}

let flowCards = await Homey.flow.getFlows();
flowCards = Object.values(flowCards).map(f => ({name: f.name, count: f.triggerCount}))

//// Sort results by Trigger Counter:
var newObjCount = flowCards.sortBy('count');
const myFlowsCtr = JSON.stringify(newObjCount, null, 4);

//// Optional: create/update HScript variable
await tag("FlowTriggers_counters", myFlowsCtr);

console.log(myFlowsCtr);

Well, I found some flows which need some tuning! :woozy_face: :crazy_face:
[
{
“name”: “Homey P= +2Watt”,
“count”: 2867027
},
{
“name”: “Oven AANgezet”,
“count”: 2006755
},
{
“name”: “Oven UITgegaan”,
“count”: 1999514
},

  • Sorted by name can be handy too:
// Get the Trigger count for all flows, sorted by flow name

Array.prototype.sortBy = function(p) {
  return this.slice(0).sort(function(a,b) {
    return (a[p] > b[p]) ? 1 : (a[p] < b[p]) ? -1 : 0;
  });
}

let flowCards = await Homey.flow.getFlows();
flowCards = Object.values(flowCards).map(f => ({name: f.name, count: f.triggerCount}))

//// Sort results by Flow Name:
var newObjName = flowCards.sortBy('name');
const myFlowsNames = JSON.stringify(newObjName, null, 4);

//// Optional: create/update HScript variable
await tag("FlowTriggers_names", myFlowsNames);

console.log(myFlowsNames);
3 Likes

Woke up to this:

But seem like a false alarm

Do you use Countdown app in those flows by any chance ? Those “temp” errors could simply shows that some of the app crashed or get restarted - it happened to me today, after Countdown 2.0.7 was faulty but luckily developer fixed it right after with 2.0.8. - but in the meantime app has been crashing constantly.

1 Like

You know what - I actually do!
And it seem that it happend only in flows that use it as AND criteria

:man_facepalming:
Edit: No, I don’t. I use the Chronograph app. But I use it coincidentally in all those apps.