Hello i'am trying to control my fan with LUA.
I use this Lua script: https://www.domoticz.com/wiki/Humidity_control
Instead of of humidity i will control my fan with air quality, so i changed SENSOR_NAME = 'Co2 living room'
But then i get the error LUA: current is 0 or nil. Skipping this reading.
The C02 value comes from a Netatmo wheaterstation.
Tanks for your help.
Piacco
Control Fan with Lua
Moderator: leecollings
-
- Posts: 191
- Joined: Wednesday 26 November 2014 18:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Control Fan with Lua
You could try this dzvets script:
Code: Select all
return {
active = true,
on = {
timer = {'every 5 minutes'}
},
data = {
previousHumidity = { initial = 100 }
},
execute = function(domoticz)
local bathroomSensor = domoticz.devices('BathroomSensor')
if (bathroomSensor.humidity - domoticz.data.previousHumidity) >= 5) then
-- there was a significant rise
domoticz.devices('Ventilator').switchOn()
end
-- store current value for next cycle
domoticz.data.previousHumidity = bathroomSensor.humidity
end
}
Who is online
Users browsing this forum: No registered users and 1 guest