# Detecting a peak/rampup of a measurement

**URL:** <https://community.homey.app/t/detecting-a-peak-rampup-of-a-measurement/91277>\
**Category:** Questions & Help\
**Created:** [October 8, 2023, 11:41am UTC](https://community.homey.app/t/detecting-a-peak-rampup-of-a-measurement/91277 "2023-10-08T11:41:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philip\_Meulenkamp](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/philip_meulenkamp/32/68549_2.png) [@Philip\_Meulenkamp](https://community.homey.app/u/Philip_Meulenkamp)\
**Post date:** [October 8, 2023, 11:41am UTC](https://community.homey.app/t/detecting-a-peak-rampup-of-a-measurement/91277/1 "2023-10-08T11:41:51Z")

</div>

Hi,

**My question**  
I want to be able to detect a peak (actually: the sudden increase of a value very quickly) in a measured value (eg humidity sensor, because there is someone showering) to start a flow (eg turn on the fan).

**How to do that and the ‘problem’**  
Now you can (possibly started by an If… card : ‘humidity has changed’) compare a measured value every few minutes with a measured value from 3 minutes ago and if the difference is large enough let a flow trigger. That means, for an ever-changing value of itself such as humidity, that this measurement ‘loop’ often starts running. If I have more flows like that, there are often a lot of those ‘loops’, with only a real trigger every now and then because someone is showering - resulting in a ?unnecessary? CPU load for the HomeyPro23.

\*\*Smarter? \*\*  
I checked the features of [math.js | an extensive math library for JavaScript and Node.js](https://mathjs.org/docs/reference/functions.html), but I can’t find something helpful. Does anyone know a smart way to detect the rapid increase in a reading, preferably in a simple and compact way and with a low CPU load for the HomeyPro23?

Do you want to share your approach to detecting a peak/fast increasing reading?

Greetings,

Philip

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [October 8, 2023, 11:46am UTC](https://community.homey.app/t/detecting-a-peak-rampup-of-a-measurement/91277/2 "2023-10-08T11:46:10Z")

</div>

Check out [Insight Trends Reloaded App for Homey | Homey](https://homey.app/a/com.spkes.insightTrendsReloaded/)

---

<div class="post-metadata">

**Author:** ![Philip\_Meulenkamp](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/philip_meulenkamp/32/68549_2.png) [@Philip\_Meulenkamp](https://community.homey.app/u/Philip_Meulenkamp)\
**Post date:** [October 8, 2023, 12:54pm UTC](https://community.homey.app/t/detecting-a-peak-rampup-of-a-measurement/91277/3 "2023-10-08T12:54:32Z")

</div>

Dank @robertklep . Ziet er veelbelovend uit. Had ik niet gevonden zonder jouw tip. Dank!  
Philip

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [October 8, 2023, 4:40pm UTC](https://community.homey.app/t/detecting-a-peak-rampup-of-a-measurement/91277/4 "2023-10-08T16:40:58Z")

</div>

This is another way to achieve it, using the[Device capabilities app](https://community.homey.app/t/app-pro-device-capabilities-enhance-the-capabilities-of-devices/43287).  
The flow part below detects very well if the shower started to run;

When the humidity changed, it checks if the value is 6% higher than the value was a minute ago:  
While you don’t want false positives, you have to measure the min/max difference of the humidity values in one minute. 6% works good in my case.

 ![Screenshot from 2023-10-08 18-39-39](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/8/4/84ea08b9d9e88574eed896c21a69f089c3ad10ff.png)
