Page 8 of 8
Re: Lua script for controlling humidity in the bathroom
Posted: Saturday 03 April 2021 21:52
by waaren
Hcroij wrote: ↑Saturday 03 April 2021 20:40
The Wiki script on line 61 on the waaren script (few posts above) its around line 52 or so.
This error message does imply one of the required variables is not there.
Insert below code somewhere before line 61. It will show your vars and values .
You need to look for
humCounter
humidityTmin5
humidityTmin10
targetFanOffHumidity
fanMaxTimer
fanFollowsProgram
If they are all there and all have a value, the SENSOR_NAME is not defined.
Please be aware that variable- and devices names are case sensitive.
Code: Select all
-- loop through all variables and show name and vulue
for variableName,variableValue in pairs(uservariables) do
print ("Variable '"..variableName.."', value '"..tostring(variableValue).."'");
end
Re: Lua script for controlling humidity in the bathroom
Posted: Sunday 04 April 2021 16:59
by Hcroij
Hi Waaren,
Afraid you are right. And pointing me in the right direction.
You dont want to know how long it took for me to figure out what was wrong.
The "Evel doing thingy" .. Status: LUA: Variable 'targetFanOffHumidity ', value '0'
There is was a trailing space after the variable, prob done by beiing lazy and copying the variables instead of typing them.
Here are the new results of the script including your "Variable"script
Status: LUA: - Humidity control -
Status: LUA: Variable 'targetFanOffHumidity', value '0'
Status: LUA: Variable 'fanMaxTimer', value '0'
Status: LUA: Variable 'humidityTmin10', value '46'
Status: LUA: Variable 'TEST_MODE_HUMVAR', value '60'
Status: LUA: Variable 'fanFollowsProgram', value '0'
Status: LUA: Variable 'humidityTmin5', value '46'
Status: LUA: Variable 'humCounter', value '2'
Status: LUA: - Humidity control - Current humidity:46
Status: LUA: - Humidity control - targetFanOffHumidity:0
Status: LUA: - Humidity control - humidityTmin5: 46
Status: LUA: - Humidity control - humidityTmin10: 46
Status: LUA: - Humidity control - fanMaxTimer: 0
Status: LUA: - Humidity control - humCounter:2
Status: LUA: - Humidity control - fanFollowsProgram:0
Status: LUA: Temperatuur van de Badkamer is: 21.2º
Status: LUA: Humidity van de Badkamer is: 46%
Status: LUA: Dauwpunt van de Badkamer is 9.1211023330688º
The last 3 are the values of "local SENSOR_NAME = 'Vocht' -- exact device name of the humidity sensor
Re: Lua script for controlling humidity in the bathroom
Posted: Monday 01 November 2021 14:15
by Joske
Hello, an short question:
I see that the script 'sees' if the fan was manually turned on before the script does.
I would like to use an manual switch also, so i can turn it on before i shower and use this script for the kids or if i forget.
How does this work with this script?
Does it turn the script off or does the script exact the same, so even with the fan turned ON it will collect date and fills the 'Delta'.
Thanks
Re: Lua script for controlling humidity in the bathroom
Posted: Thursday 03 February 2022 12:40
by sammyke007
Installed a "simple" S&P Silent 100 ventilator without any extra sensors in my bathroom behind a simple Sonoff switch. The ventilators with "smart" sensors are a lot more expensive! Tnx to a simple Aqara / Xiaomi temp/hum sensor, the vent (Sonoff) turns on at the right moments with this great script. Thanks!
Re: Lua script for controlling humidity in the bathroom
Posted: Wednesday 18 January 2023 22:13
by coolchilli
i'm having a strange issue with this script, which, having read through the whole of the topic history - I don't think I've seen anyone else suffer...
I have a simple ON/OFF switch setup to control my ventilator which is behind a Wemo. I have two scripts written to control the Wemo - one is called fan_on.sh and the other is called fan_off.sh
When using the UI to control the switch, everything works perfectly. When controlling the Wemo from command line - everything works as it should.
However the humidity script activates the fan_off.sh script when humidity rises... why would this be? Is it something to do with the configuration of the switch?