calculate rate of change of a variable

Posted on
Thu Sep 07, 2017 7:49 pm
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

calculate rate of change of a variable

I'm wanting to calculate the rate of change of a variable (humidity in a bathroom), and use this as one of the conditions for triggering an action group (e.g. turn on fan when humidity has increased by > 10 in the last 5 minutes)..

what's the most appropriate way to do this calculation? e.g. retrieve the old value from postgreSQL; or update a variable based on a schedule?

Posted on
Fri Sep 08, 2017 12:40 pm
rehafer offline
Posts: 279
Joined: Feb 08, 2013

Re: calculate rate of change of a variable

I haven't done this myself but my first guess would be have an event scheduled every 5 minutes that take ([current value] - [variable with old value])/5 compared to your target rate per minute; then put [current value] into {variable}.


Sent from my iPhone using Tapatalk

Posted on
Fri Sep 08, 2017 4:17 pm
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

Re: calculate rate of change of a variable

thanks. that makes sense.

Posted on
Mon Sep 18, 2017 10:10 pm
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

Re: calculate rate of change of a variable

works brilliantly
...and a much better algorithm for automating fan control than anything else I've tried! Turns off when humidity has stabilised provided it has returned to near the original reading.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest

cron