@dzt
Ah yes makes sense.
I already have something on my todo list for this.
Will check
And thanks!!
No change unfortunately.
Thanks Martijn. I just wonder what could be possibly wrong, take a look on screenshots…
And one of the flow :
I don’t see any variable broken…tried re-saving, no difference.
Common is “()” in the name of variable (defined by the app itself).
1. FIX: settings page issue for new users.
2. FIX: findLogic
@Sharkys made a fix. Can you check if this resolves it?
excellent, thank you ! Old broken flows disappeared, 4 new broken appeared as expected, well done
Nice!
Hi Martijn,
No clue if it’s realistic, but is it possible to show an overview of Logics Vars (and BetterLogic maybe) and the flows they reside in?
(I have a script for that (below this message) ).
Or better, a search field “Find the flow(s) used with this variable”.
Enter a (partial) variable name, and it returns the flowname(s).
I don’t know what the impact will be on the memory usage of the app.
(How did I ever do without Flow Checker… )
Cheers!
// FindLogicsVarsInFlows.js
//
// Script to find Homey Logics Variables in Flows, and orphaned Variables (by RonnyW)
// Adjusted somewhat, when called from a flow, it returns the output in a Variable (PD)
const flows = await Homey.flow.getFlows();
const logicVars = await Homey.logic.getVariables();
let flowMatches;
let varUsed;
let position = [];
let results2Var; // To be able to build a string to output the results to
// a variable [FoundLogicsVarsInFlows], for usage in flows
results2Var = ("*** Logics Variables found in Flows ***\n\n script: FindLogicsVarsInFlows.js\n\n");
for (var iLogicVar in logicVars){
results2Var = results2Var + "\n**VARIABLE:** ["+logicVars[iLogicVar].name + "]\n";
let logicVar = logicVars[iLogicVar].name;
let logicVarId = logicVars[iLogicVar].id;
varUsed = false;
for (var iFlow in flows){
flowMatches = false;
position = [];
// Search for variable name in Triggers
if (flows[iFlow].trigger.uri == "homey:manager:logic"){
for (var iArgs in flows[iFlow].trigger.args){
if ( flows[iFlow].trigger.args[iArgs].name == logicVar
|| flows[iFlow].trigger.args[iArgs].id == logicVarId){
position.push("Trigger card (IF)");
flowMatches = true;
}
}
}
// Search for variable name in Condition cards
for(var iCond in flows[iFlow].conditions){
if ( flows[iFlow].conditions[iCond] &&
flows[iFlow].conditions[iCond].uri == "homey:manager:logic"){
//log(flows[iFlow].conditions[iCond].args);
for (var iArgs in flows[iFlow].conditions[iCond].args){
if ( flows[iFlow].conditions[iCond].args[iArgs].name == logicVar
|| flows[iFlow].conditions[iCond].args[iArgs].id == logicVarId ){
position.push("Condition (AND) - direct reference");
flowMatches = true;
}
}
}
for (var iArgs in flows[iFlow].conditions[iCond].args){
if ( flows[iFlow].conditions[iCond].args[iArgs] &&
JSON.stringify( flows[iFlow].conditions[iCond].args[iArgs] ).indexOf( logicVarId ) > 0 &&
JSON.stringify( flows[iFlow].conditions[iCond].args[iArgs] ).indexOf( "homey:manager:logic" ) > 0 ){
position.push("Condition (AND) - indirect reference (Tag)");
flowMatches = true;
}
}
}
// Search for variable name in Action cards
for(var iAct in flows[iFlow].actions){
if ( flows[iFlow].actions[iAct] &&
flows[iFlow].actions[iAct].uri == "homey:manager:logic"){
for (var iArgs in flows[iFlow].actions[iAct].args){
if ( flows[iFlow].actions[iAct].args[iArgs].name == logicVar
|| flows[iFlow].actions[iAct].args[iArgs].id == logicVarId ){
position.push("Action (THEN) - direct reference");
flowMatches = true;
}
}
}
for (var iArgs in flows[iFlow].actions[iAct].args){
if ( flows[iFlow].actions[iAct].args[iArgs] &&
JSON.stringify( flows[iFlow].actions[iAct].args[iArgs] ).indexOf( logicVarId ) > 0 &&
JSON.stringify( flows[iFlow].actions[iAct].args[iArgs] ).indexOf( "homey:manager:logic" ) > 0 ){
position.push("Action (THEN) - indirect reference (Tag)");
flowMatches = true;
}
}
}
// Results of Flows found:
if (flowMatches == true){
varUsed = true;
results2Var = results2Var + " - ";
results2Var = results2Var + "**Flowname:** (" + flows[iFlow].name + ") \n";
results2Var = results2Var +" -Position: \n";
for (iPos in position){
results2Var = results2Var + " -" +position[iPos] + " / \n";
}
}
}
if (!varUsed){
results2Var = results2Var +"*** NOT FOUND IN FLOWS *** \n\n";
}
}
// Output to a StringVariable [FoundLogicsVarsInFlows]
await tag( "FoundLogicsVarsInFlows", results2Var );
//
// Output (just test to view the result data in 'results2Var')
//console.log(results2Var)
return(true);
Hey @Peter_Kawa
I like the idea
It should be possible. Just thinking what the best place should be for this.
Hi @martijnpoppen,
after the last app update v1.16.2 all the variables used as “value storage” are recognized as UNUSED_LOGIC again. The same issue like mentioned in post #295.
Info:
– Variable Hue_Lesen_Dimm = 1
– Variable Hue_Lesen_Temp = 0.55
This issue was solved with app v1.16.0.
If it’s not fixable or to complicated to fix, I will use “normal” values in the flows instead of logic variables.
Will have a check @fantross
Probalby I can fix it but then I’ll @Sharkys too to test. As this seems to conflict with each other
I wasn’t reporting issues with unused variables, it was other way around - until latest Flow check version, it reported something broken, which was not and something not broken, which actually was
Yes exaclty. But that’s on the same line
So it’s conflicting in some way
will check!
1. FIX: nested logic
@fantross can you check?
@Sharkys everything still working?
seems to be ok after upgrade and forcing the check
Hi Martijn,
Because I’m having some problems with my Homey in terms of memory, I’m working with Athom to find out where the problem is.
They indicate that my memory is usually at 200% and that it is most likely due to some apps and flows that run too often etc.
I just wouldn’t know what flows that could be.
Is there an option in flow checker to see how often a certain flow is run and if it consumes too much memory?
All my apps stay well below 30mb of memory so I don’t know where to look for the problem.
Thank you.
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…
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
Thanks Martijn.