Problem with rules for fan control with humidity and PWM

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
obstbauer
Normal user
Posts: 41
Joined: 25 May 2023, 15:46

Problem with rules for fan control with humidity and PWM

#1 Post by obstbauer » 29 Dec 2023, 21:42

Hello,
I try to control a fan with measured humdity, PWM and rules but I don't find a working solution.
I know how to do it with python or C but I have problems to understand the rules logic.
I want to control:

Humid < 50 PWM 300
Humid >51 and <61 PWM 700
Humid >61 and < 70 PWM 900
Humid > 70 PWM 1023

The hardware and the sensors work.
I tried things like that:
On
if [BME280#Humidity]>51 and [BME280#Humidity]<61
PWM,12,700
end if
Endon

for every step one rule but it doesn't work

The only thing which works was:

On BME280#Humidity<50 Do
PWM,12,300
Endon

On BME280#Humidity>50 Do
PWM,12,1023
Endon

in one rule but with this I only have two steps.

Maybe you can help me? Thank you!

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Problem with rules for fan control with humidity and PWM

#2 Post by TD-er » 29 Dec 2023, 21:53

Humid < 50 PWM 300
Humid >51 and <61 PWM 700
Humid >61 and < 70 PWM 900
Humid > 70 PWM 1023
See: https://espeasy.readthedocs.io/en/lates ... lseif-else

Code: Select all

On BME280#Humidity Do
  if %eventvalue1% > 70
    pwm,12,1023
  elseif %eventvalue1% > 60
    pwm,12,900
  elseif %eventvalue1% > 50
    pwm,12,700
  else
    pwm,12,300
  endif
Endon

obstbauer
Normal user
Posts: 41
Joined: 25 May 2023, 15:46

Re: Problem with rules for fan control with humidity and PWM

#3 Post by obstbauer » 29 Dec 2023, 23:06

it works!
Thanks a lot !

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 33 guests