How to do mathematic calculations

I want to start a fan when relative humidity is lower outside than in the basement. To make this work I need to calculate the new relative humidity when the air cools down in the basement.
The formula for this is pretty advanced as you can see below. G1 to G3 is sensor values of indoor and outdoor temperatures and outdoor relative humidity.
Is it possible to create a flow for this?
I suppose I need better logic app.


Gues you can do this easely in HomeyScript.

Then I need to learn how to do scripts.
you’r never to old to learn, just start, search this forum for HomeyScript and if you get stuck, you always can ask here for help/support. It’s FUN :smiley:

Install the app betterlogic
It supports math.js functions

What I would do is split it up in several flows and use multiple variables…

Something like:
When Temp changes THEN calculate the part with the temp in it and assign tthe outcome to a variable1

When humidity changes THEN calculate the part with the humidity in it and assign tthe outcome to a variable2

When variable1 changes THEN calculate the next part and assign tthe outcome to a variable


You can easily do this with better-logic app. I have made similar calculation to calculate the absolute humidity of outside and inside temperature, which can be compared.

sisäkosteus=indoor humidity
AH=absolute humidity

1 Like