I want a function that counts the time when the temperature is above a defined threshold level.
Believed that should be very simple, but I got stuck immediately…
I thought it should be possible to have a time tick (every minute), check if the temperature is above the treshold and if so just increase the value of a variable.
But how do I generate a time tick? Do I need an app for that? If so, are there any available for Homey Bridge?
And how do I increment a variable?
When T > threshold, then “start or resume stopwatch” (not “start or replace”)
When T < threshold then “Stop or pause stopwatch”, “Get elapsed duration of stopwatch”, etc
Elapsed duration:
PS If you want to take into account that T can go above and below the threshold a couple of times, use pause instead of stop stopwatch so you can resume it again. In that case add eg:
When time is 00.00, then stop stopwatch.
You can make a flow that runs every minute. If the condition applies, add +1 to a variable “counter”. The counter value tells you how many minutes the condition has been true.
If the condition is true at 00:01:00 when it gets sampled, then goes false at 00:01:30, then goes true at 00:02:00 when it gets sampled again, you could mistakenly assume that it was true all the time between 00:01 and 00:02.
I do not know the nature of your sampled parameter i.e. how often it is typically changing. To save system load, don’t use 1 minute interval if it’s not needed. This was just an example.
It seems more limited in the Bridge. Perhaps they are protecting either the processing capacity of the device or the upselling appeal of the Pro. Or both