Hello
I have a two speed bathroom fan. I want to turn them on depending on the humidity. And it should block from turning on automatically during the night.
I put everything together, And it runs so far, but he is running always on level 1. I think something on my script is wrong.
Does anyone with experience see the fault?
on [TempHum#Humidity]<65 do //if humidity under lowerlevel then van off
gpio,14,1
gpio,12,1
endon
on [TempHum#Humidity]>65 and [TempHum#Humidity]<75 do //if humidity between lower and uper level then van level1
if [VirtualSwitch1#Dummy1]=0 //check if night block
gpio,14,0
gpio,12,1
endif
endon
on [TempHum#Humidity]>75 do //if humidity over uperlevel then van level2
if [VirtualSwitch1#Dummy1]=0 //check if night block
gpio,14,0
gpio,12,0
endif
endon
Another bathroom ventilation project
Moderators: grovkillen, Stuntteam, TD-er
Re: Another bathroom ventilation project
There are a few syntax errors in your code: (Check Rules syntax here: https://espeasy.readthedocs.io/en/lates ... Rules.html)Bluesea wrote: ↑15 Oct 2023, 12:10 Hello
I have a two speed bathroom fan. I want to turn them on depending on the humidity. And it should block from turning on automatically during the night.
I put everything together, And it runs so far, but he is running always on level 1. I think something on my script is wrong.
Does anyone with experience see the fault?
Code: Select all
on TempHum#Humidity do
if %eventvalue1%<65 or [VirtualSwitch1#Dummy1]=1 //if humidity under lower level or night-block then fan off
gpio,14,1
gpio,12,1
endif
if %eventvalue1%>65 and %eventvalue1%<75 //if humidity between lower and upper level then fan level1
if [VirtualSwitch1#Dummy1]=0 //check if night block
gpio,14,0
gpio,12,1
endif
endif
if %eventvalue1%>75 //if humidity over upper level then fan level2
if [VirtualSwitch1#Dummy1]=0 //check if night block
gpio,14,0
gpio,12,0
endif
endif
endon
(Air code )
/Ton (PayPal.me)
Re: Another bathroom ventilation project
Yep, the main thing you should realize is that in the on...do part you should not use []
When parsing the rules, everything wrapped in [] is being converted into a numerical.
Thus the on...do part will probably not match if you use [] in that line.
Also you can't use "and" or other logic operators in the on...do line.
When parsing the rules, everything wrapped in [] is being converted into a numerical.
Thus the on...do part will probably not match if you use [] in that line.
Also you can't use "and" or other logic operators in the on...do line.
Re: Another bathroom ventilation project
Wow, thank you very much! Now it does what I want. I'm still learning this rules.
Who is online
Users browsing this forum: Bing [Bot] and 0 guests