Lua script for controlling humidity in the bathroom Topic is solved

Moderator: leecollings

User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Lua script for controlling humidity in the bathroom

Post 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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Hcroij
Posts: 24
Joined: Sunday 27 November 2016 16:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Lua script for controlling humidity in the bathroom

Post 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
Joske
Posts: 40
Joined: Wednesday 10 June 2020 9:20
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Lua script for controlling humidity in the bathroom

Post 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
sammyke007
Posts: 204
Joined: Monday 08 May 2017 20:48
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Belgium
Contact:

Re: Lua script for controlling humidity in the bathroom

Post 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!
coolchilli
Posts: 6
Joined: Monday 29 August 2022 18:56
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Lua script for controlling humidity in the bathroom

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests