Detecting Rapid Humidity Changes for Smart Fan Control

Hi everyone, I’m curious about how you handle rapid changes in sensor readings, specifically humidity. I’m trying to set up a system where my fan turns on automatically when someone takes a shower, detected by a sudden spike in humidity.

Currently, I’m using a basic approach where the system checks the humidity every few minutes and compares it to the value from 3 minutes ago. If the difference is significant, it triggers the fan. However, this method seems to create a lot of unnecessary loops, especially since humidity levels are constantly fluctuating. With multiple flows running, I’m worried about the CPU load on my HomeyPro23.

I’ve looked into using math.js for a smarter solution, but I couldn’t find anything that fits my needs. Does anyone have a more efficient method for detecting rapid increases in sensor readings? Maybe a way to smooth out the data or set adaptive thresholds?

I’d love to hear your approaches and any tips for reducing CPU usage while maintaining reliability. Thanks in advance for your insights!