Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team

Question
TSN1 1
Hi everybody,
Who can help me with my lil problem. Im trying to get a 0-10Vdc signal to my ventilation box controlled bij air quality.
the higher the Co2 gets the higher the 0-10Vdc signal gets.
Now i have been writing some LUA (im a beginner of the beginners). with a bit of cut and paste and modifying etc etc etc.....
but i cant get a finger on the problem in this one:
--[[
%% properties
%% globals
448 value
467 value
470 value
473 value
%% time
%% autostart
--]]
while true do
local LQ1 = fibaro:getValue(448, "value");-- ID of Air quality woonkamer
local LQ2 = fibaro:getValue(473, "value");-- ID of Air quality slaapkamer 1
local LQ3 = fibaro:getValue(467, "value");-- ID of Air quality slaapkamer 2
local LQ4 = fibaro:getValue(470, "value");-- ID of Air quality slaapkamer 3
local LQsturing = 496; -- ID of WTW sturing 0-10Vdc
Q40 ="400"
Q45 ="450"
Q50 ="500"
Q55 ="550"
Q60 ="600"
Q65 ="650"
Q70 ="700"
Q75 ="750"
Q80 ="800"
Q85 ="850"
Q90 ="900"
Q100 ="950"
local startSource = fibaro:getSourceTrigger();
if ((LQ1 > Q100 ) or (LQ2 > Q100) or (LQ3 > Q100) or (LQ4 > Q100))
then
fibaro:call(LQsturing, "setValue", "100")
if tonumber(fibaro:getValue(LQsturing, "value")) > 0 then fibaro:debug("WTW unit krijgt 100% sturing"); end
elseif ((LQ1 > Q90) or (LQ2 > Q90) or (LQ3 > Q90) or (LQ4 > Q90))
then
fibaro:call(LQsturing, "setValue", "88")
if tonumber(fibaro:getValue(LQsturing, "value")) > 0 then fibaro:debug("WTW unit krijgt 90% sturing"); end
elseif ((LQ1 > Q85) or (LQ2 > Q85) or (LQ3 > Q85) or (LQ4 > Q85))
then
fibaro:call(LQsturing, "setValue", "83")
if tonumber(fibaro:getValue(LQsturing, "value")) > 0 then fibaro:debug("WTW unit krijgt 85% sturing"); end
elseif ((LQ1 > Q80) or (LQ2 > Q80) or (LQ3 > Q80) or (LQ4 > Q80))
then
fibaro:call(LQsturing, "setValue", "78")
if tonumber(fibaro:getValue(LQsturing, "value")) > 0 then fibaro:debug("WTW unit krijgt 80% sturing"); end
elseif ((LQ1 > Q75) or (LQ2 > Q75) or (LQ3 > Q75) or (LQ4 > Q75))
then
fibaro:call(LQsturing, "setValue", "73")
if tonumber(fibaro:getValue(LQsturing, "value")) > 0 then fibaro:debug("WTW unit krijgt 75% sturing"); end
elseif ((LQ1 > Q70) or (LQ2 > Q70) or (LQ3 > Q70) or (LQ4 > Q70))
then
fibaro:call(LQsturing, "setValue", "68")
if tonumber(fibaro:getValue(LQsturing, "value")) > 0 then fibaro:debug("WTW unit krijgt 70% sturing"); end
elseif ((LQ1 > Q65) or (LQ2 > Q65) or (LQ3 > Q65) or (LQ4 > Q65))
then
fibaro:call(LQsturing, "setValue", "63")
if tonumber(fibaro:getValue(LQsturing, "value")) > 0 then fibaro:debug("WTW unit krijgt 65% sturing"); end
elseif ((LQ1 > Q60) or (LQ2 > Q60) or (LQ3 > Q60) or (LQ4 > Q60))
then
fibaro:call(LQsturing, "setValue", "58")
if tonumber(fibaro:getValue(LQsturing, "value")) > 0 then fibaro:debug("WTW unit krijgt 60% sturing"); end
elseif ((LQ1 > Q55) or (LQ2 > Q55) or (LQ3 > Q55) or (LQ4 > Q55))
then
fibaro:call(LQsturing, "setValue", "53")
if tonumber(fibaro:getValue(LQsturing, "value")) > 0 then fibaro:debug("WTW unit krijgt 55% sturing"); end
elseif ((LQ1 < Q50) or (LQ2 < Q50) or (LQ3 < Q50) or (LQ4 < Q50))
then
fibaro:call(LQsturing, "setValue", "0")
if tonumber(fibaro:getValue(LQsturing, "value")) < 5 then fibaro:debug("WTW unit krijgt 0% sturing"); end
end
fibaro:debug("Woonkamer is " .. LQ1 .. " ppm");
fibaro:debug("Slaapkamer 1 is " .. LQ2 .. " ppm");
fibaro:debug("Slaapkamer 2 is " .. LQ3 .. " ppm");
fibaro:debug("Slaapkamer 3 is " .. LQ4 .. " ppm");
fibaro:sleep(60*5000)
end
what is wrong with this???
Thanks for helping!!
Greetings TSN
6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.