Detection of sudden increase in RH

In my bathroom, I have a Sonoff SNZB-02 temperature & humidity sensor that I use to detect when the active ventilation should run. The flow to start ventilation just checks if the humidity rises over 90% and starts the fan which runs for an hour or so. This worked fine in the summer when the base temperature in the bathroom was relatively high by itself.

Unfortunately, with the dropping outside temperatures, the base temperature in the bathroom is low. When starting shower, the inside temperature shoots up faster than the (absolute) humidity. As a result, the relative humidity is no longer reaching the 90% threshold. Changing the threshold is possible ofcourse, but than I have to continuously do that to adjust for ambient temperatures.

I do see, however, the temperature and humidty climb quickly, Example reading (from this morning, note that I switched the fan on by hand when leaving the shower, thus the sudden fall in RH after a couple minutes):

So, I am looking for a way to check the rapid change in temperature and/or RH, along the lines of a check against a value some minutes earlier. How can I do that using standard flows only? Can the new advanced flow system help? I tried with the “Flow utilities” app, but I cannot access variables from other apps there and vice versa.

With Adv. Flows you can do it with the Device Capabilities app. It can read out the insights values :wink:
With Standard flows, you can write a value to a variable every x seconds / minutes
This way, you can compare the actual value with the value of x seconds / minutes ago.

(The And… cards are not relevant here)

Yeah, I got that far too, thanks. But then, I basically need a shift register, so:

int val[3] = { 0, 0, 0 };

// Execute every 30 seconds or so
doit( int newval )
{
  static bool initialized = false;
  if ( !initialized )
  {
    val[0] = val[1] = val[2] = newval;
    initialized = true;
  }
  else
  {
    val[0] = val[1];
    val[1] = val[2];
    val[2] = newval;
    if (( newval - val[0]) > 5 )
    {
       start_fan();
    }
  }
}

(oldschool C programmer here, I confess :smile: ).
I was trying to use a js script for this, but that fight is quite hopeless at the moment…

Put te value of humidity in a variable and check te value the next time. Then you no if the humidity increases.

To prevent that the fan turn on if the humidity increase over a long time you can use a timer.