Jump to content

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


  • 0

regulate heater with door sensors


Guest Forall

Question

Guest Forall

Please help!

I am trying to use some inspiration from 

Please login or register to see this link.

to regulate my air heather pump, What I want it to do is that when any of my doors has been open for more than 45 sec, turn off the heater and then wait untill all the doors has been closed for 45 sec before turning on again. But unfortionatly i dont get it to work and cant se what the problem is. Sadly i am yet not experienced enought with lua butneed to learn, i now have 80 scenes reulating some 73 switches and sensors. 

 

--[[
%% properties
93 value
%% globals
--]]
 
local Doorfront = 149 -- main door
local Doorback = 50 -- Rear door
local Doorside = 52 -- Side door
local heater = 218
local heatDelay = 45 -- 45 seconds (the value is in seconds)
local heatstart = 45 -- 45 seconds (the value is in seconds)
 
-- Only allow one instance of the current scene to run at a time
if (fibaro:countScenes() > 1) then
  fibaro:abort()
end
 
local value, timestamp = fibaro:get(Doorfront, 'frontvalue')
local value, timestamp = fibaro:get(Doorback, 'backvalue')
local value, timestamp = fibaro:get(Doorside, 'sidevalue')
local value, timestamp = fibaro:get(Doorfront, 'frontvaluestart')
local value, timestamp = fibaro:get(Doorback, 'backvaluestart')
local value, timestamp = fibaro:get(Doorside, 'sidevaluestart')
if (frontvalue == '0') and (backvalue == '0') and (sidevalue == '0')then -- is the light off?
  -- the doors are closed
 
  -- keep looping until the door has been open for heatDelay time
  while ((frontvalue ~= '0') or (rearvalue ~= '0') or (sidevalue ~= '0') or ((os.time() - timestamp) < heatDelay)) do
    fibaro:sleep(1000) -- let other things happen for a second, just wait here
    value, timestamp = fibaro:get(Doorfront, 'frontvalue')
    value, timestamp = fibaro:get(Doorback, 'backvalue')
    value, timestamp = fibaro:get(Doorside, 'sidevalue')
  end
  -- the doors has been open long enought
  fibaro:call(heater, 'turnOff') -- turn off the fan
else
  -- the doors are closed
  while ((frontvalue = '0') and (rearvalue = '0') and (sidevalue = '0') or ((os.time() - timestamp) < heatstart)) do
    fibaro:sleep(1000) -- let other things happen for a second, just wait here
    value, timestamp = fibaro:get(Doorfront, 'frontvaluestart')
    value, timestamp = fibaro:get(Doorback, 'backvaluestart')
    value, timestamp = fibaro:get(Doorside, 'sidevaluestart')
  end
  
  fibaro:call(heater, 'turnOn') -- turn on the heater
end
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...