This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Thresholds
#2
HI Bergman

I am not sure that it is exactly what you need, but have a try,
and please give me feedback.

This code is for humidity scale object (event script).

Code:
local humidity = event.getvalue() -- scale object

local fan_addr = '38/1/26' -- scale object

local fan_val_level_1 = 30 -- values for scale object
local fan_val_level_2 = 60
local fan_val_level_3 = 100

if humidity < 33 then -- humidity less than 33%
  grp.write(fan_addr, fan_val_level_1)
elseif humidity > 38 and humidity < 66 then -- 38% < humidity < 66%
  grp.write(fan_addr, fan_val_level_2)
elseif humidity > 71 then -- humidity more than 71%
  grp.write(fan_addr, fan_val_level_3)
end

Regards,
Romans

Here is updated version of the script.

Code:
local humidity = event.getvalue() -- scale object

local fan_addr = '38/1/26' -- scale object

local fan_val_level_1 = 30 -- values for scale object
local fan_val_level_2 = 60
local fan_val_level_3 = 100

local hyst = 5 -- 5% humidity hysteresis

local hum_level_1 = 33 -- 33% humity
local hum_level_2 = 66 -- 66% humidity

if humidity < hum_level_1 then -- humidity less than 33%
  grp.write(fan_addr, fan_val_level_1)
elseif humidity > hum_level_1 + hyst and humidity < hum_level_2 then -- 38% < humidity < 66%
  grp.write(fan_addr, fan_val_level_2)
elseif humidity > hum_level_2 + hyst then -- humidity more than 71%
  grp.write(fan_addr, fan_val_level_3)
end
Reply


Messages In This Thread
Thresholds - by Bergman - 17.01.2024, 09:35
RE: Thresholds - by RomansP - 17.01.2024, 10:33
RE: Thresholds - by Bergman - 17.01.2024, 17:27
RE: Thresholds - by RomansP - 18.01.2024, 07:33

Forum Jump: