Actually, i think its the 5 second that you want in this flow.
In the above flow, you update the value of the variable, but at the exact same time, you send the variable to your Phone. The 2 then-flowcards in the above (first) flow you showen, are fired at once, so you get the old value on your Phone.
It could have been, but its not. That was the first thing I experimented with. And since the tag does not get updated either (see first post), It had to be something else. Im not sure how BLL handle the variables, but it seems that if I dont convert it with stringify, BLL handles the new value in the variable within the app, but somehow the Tag does not get updated.
Based on these states I can set the brightness etc, but I don’t want to be able to have typos when checking if a logic value is exactly a certain value.
Because the flow will have many ‘If, And, Then’ using this logic, having exact select-able values will make things so much easier.
About two days ago, one of my apps failed with The Better Logic Library App is not running.So I restarted the BL app and it still failed, I tried a couple of times before removing and re-installing the app but the same result, any ideas on how to get this back working?
Did you also restart or even re-install the app which notified you with that error msg?
Removing apps and install them again to ‘solve’ issues is almost never necessary:
With re-install I mean install from homey.app store, without removing it in advance. This will not destroy all your devices and settings.
I’m getting hour value in the better logic mathjs calculation like this $#HH$. Before the latest update on Homey this worked, but right now it’s not giving correct values, for example at the moment the $#HH$ gives 0 as an results, though the time is actually 8:45. I have checked that the Homey clock is correct so it shouldn’t be that.
Same problem is also when trying to get the minute value with same method $#mm$
Anyone else having the same problem? Or any idea what is wrong?
Good point. I have been using the better logic app way before this option was possible and have been using the mentality “If it works don’t touch it”.
I’ll change my flows to use the BLL coding hour and minute functions as you proposed.
Still there might be other “old” users which use this and apparently there has been some breaking changes. Is it on Homeys end or in the Better logic app?
When I tried to calculate this every 5s to get the more accurate seconds timevalue the result was that the loading of the Homey skyrocketed. So the previous use of $#HH$, $#mm$ and $#ss$ expression was way more efficient.
Is there some other way to do this more CPU load efficiently, so that I can use the second, minute and hour value in the calculation?
I monitor the electrical system of an apartment complex with several elevators and a few heavy-duty appliances.
Initially, in combination with a HomeWizard P1 meter, I set up a simple flow that tracks the maximum load (amperes) per phase on a daily basis.
Because I observed irregular high peaks, I suspect that the inrush current of the elevators or appliances is being measured occasionally. After all, the P1 meter always displays the current value (every 5 sec) and not the average. Therefore, I want to calculate the average over 5 values (25 sec) and filter out the ultra-short high peaks.
Using BLL (and some JavaScript help from ChatGPT), I came up with the following flow:
Card 1: When value changed, add the value in a text-array and discard the oldest value (moving average of 5 values)
Card 2:
Convert to real array of numbers
Make the values absolute (due to solar panels)
Sort in ascending order
Discard the last (highest) value
Calculate the average of the array (4 values)
Round to 2 decimal places
Card 3: Determine the maximum value for today and save it
This all works as I intended.
However, I noticed in the CPU load that this flow had quite an impact. Initially, I also used Device Capabilities to ‘watch’ for changed current-amps-per-phase (because there was no dedicated card for this). But that was extremely heavy, so I decided to replace it with the built-in flow card; this had virtually the same effect and much lower CPU-load.
Is the increase of 2% CPU (average 1% → 3%) indeed a problem and something to avoid?
Is there anything that can be done about this, perhaps with Homey Script? I still need the running average, also later for load balancing for a car charging station
To put it in the bigger picture: I have dozens of AVDs, more than 100 smart devices (lighting, switches, sensors, etc), and a whole lot of flows, some of them quite complex (but not many triggering every 5 seconds like this one). Also many apps; my Homey 2023 memory is almost full, and I’m switching to the 2026 soon (which I already have).
@FKey, thanks for the suggestion, an interesting app that I can certainly use for controlling ventilation (CO2, humidity), for example.
But for this specific running average, it isn’t precise enough, because a trend isn’t sufficient. I need the exact average with specific outliers removed.
In the meantime, I have rebuilt the flow and replaced the Better-logic cards with HomeyScript (with help from Claude AI).
Better logic’s CPU usage is back to just under 1%, whereas HomeyScript uses only 0.7% extra. So, around 1.3% less CPU for the same calculation.
I did notice that as soon as I started retrieving capabilities directly in HomeyScript, it immediately increased CPU usage. So I concluded that HomeyScript is fastest for direct calculations (input A,B,C, return X,Y,Z), but manipulation of capabilities work best in a flow.