# Best way to switch device based on multiple (depending) rules

I am strugling with my flows to to switch on a device (in my case a fan but could be any device).

The problem is I have multiple rules that are sometimes even dependend.

Problem:
Determine the correct trigger to switch On the fan
Determine the correct trigger to switch Off the fan

Rules
The ON rules:

• when the CO2 level > “extremely high” the fan should always go on
• when the CO2 level > “high” the fan should go on
• the fan should not go on when the outside temperature is > 20. (Except when CO2 > extremely high)
• the fan should go on when outside temp < inside temp AND expected temp the next day os >19degrees (cooling down in summer)
• the fan should not go on when inside temp < 14 (prevent going below dew point)

THE off Rules

• when the CO2 level > “extremely high” the fan should not turn off
• when CO2 < “normal” the fan should go off
• when the inside temp < outside temp AND the expected temp is below 19 the fan should go off

Making a lot of seperate flow could become very complex.
I was thinking about the bayesian probability

Any other suggestions???

Nice puzzling again! Not easy to keep it simple.
I think this comes close, FKey…

``````- Flow F1-5 (CO2 level > “extremely high”)
If..
CO2 level changed
And..
[CO2 level] > "extremely high"
Then..
Turn fan on
Else..
Start flow F5-5 (Fan Off if CO2 level < "normal")

***
- Flow F2-5 (CO2 level > “high”)
If..
CO2 level changed
And..
[CO2 level] > "high"
And..
[outside temp] =< 20
And..
[inside temp] > 14
Then..
Turn fan on
Else..
Start flow F5-5 (Fan Off if CO2 level < "normal")

- Flow F3-5 (CO2 level < “normal”)
If..
CO2 level changed
And..
[CO2 level] < "normal"
Then..
Start flow F5-5 (Fan Off if CO2 level < "normal")

***
- Flow F4-5 (Outside temp < Inside temp)
If..
[Outside temp] changed
And..
[Outside temp] < [Inside temp]
And..
[Expected temp the next day] > 19
And..
[Inside temp] > 14
Then..
Turn fan on
Else..
Start flow F5-5 (Fan Off if CO2 level < "normal")

***
- Flow F5-5 (Fan Off if CO2 level < "normal")
If..
This flow is started
And..
[CO2 level] < "normal"
Then..
Turn fan off

``````
1 Like