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


Recommended Posts

Posted (edited)

In my scene. i am making a schedule for my heat-it thermostat in the bathroom

 

When in auto mode, Like: at 5am till 7am turn floorheating on... set target temp to 30.

If in the meantime i would like to adjust the temp... say not 30 but 25... then I would like to change to the new temp to the desired temp.. in this case 25degrees C

it still stays inside the loop, but only change the temperature to the new temperature...

 

How can i accomplish this?

 

AND:

 

-- Manual Mode = Sleep for 2hours then AUTO again
if (Mode == 'MANUAL') and (NewTemp ~= "30" or NewTemp ~= "23") then  
    log("Manual Mode for 2hrs");
    fibaro:sleep(120*60*1000); 
    fibaro:setGlobal("Mode_FloorHeating", "AUTO");
    fibaro:call(262, "setThermostatSetpoint", "1", "15")
end

In the meantime of (fibaro:sleep(120*60*1000); ) (2 hours waiting) i am not able to change the temperature, as it's waiting for the time to finish, how can i change that?

 

This is my scene:

 

 

--[[
%% properties
%% events
%% globals
Time
--]]

 

-- debug
local debug = true; -- true

local function log(str)
  if debug then 
    fibaro:debug(str); end; end

if (tonumber(fibaro:countScenes()) > 1) then -- > 1
  log("Script already running.");
  fibaro:abort(); 
end

-- Thermostat ID
local FloorHeating = 262 -- Heatit Unit

-- Temp Sensor ID
local BathroomTempS = 263 -- Bathroom AIR Sensor

-- Get Temp (Target) Readings
local FloorBathroomTemp = tonumber(fibaro:getValue(BathroomTempS, "value"));
local FloorBathroomTargetTemp = tonumber(fibaro:getValue(FloorHeating, "targetLevel"));  

-- Get Variables
local cTime = fibaro:getGlobalValue('Time');
local cDate = os.date("*t");
local Global = fibaro:getGlobalValue("Global_Heating");
local Bathroom = fibaro:getGlobalValue("Bathroom_Heating");
local Home = fibaro:getGlobalValue("Present_State"); 
local Mode = fibaro:getGlobalValue("Mode_FloorHeating");
local NewTemp = fibaro:getGlobalValue("BathroomSetTemp");


-- Global Heating on Weekday
if ( 
  (cTime == '04:00') and (Global == 'OFF') and
    (cDate.wday==2 or cDate.wday ==3 or cDate.wday ==4 or 
      cDate.wday ==5 or cDate.wday ==6)
   ) then
  fibaro:setGlobal("Global_Heating", "ON")
end
 
-- Global Heating on Weekend
if (
    (cTime == '05:00') and (Global == 'OFF') and
    (cDate.wday==1 or cDate.wday ==7)
    ) then
  fibaro:setGlobal("Global_Heating", "ON")
end

-- School Holidays
if (
     (cTime == '08:59') and (Global == 'OFF')   
    ) then
  fibaro:setGlobal("Global_Heating", "ON")
end
 
-- Global Heating OFF Daily
if ( 
  (cTime == '22:45') and (Global == 'ON')
   ) then
  fibaro:setGlobal("Global_Heating", "OFF")
  fibaro:call(262, "setThermostatSetpoint", "1", "15")
end

fibaro:setGlobal("BathroomSetTemp", FloorBathroomTargetTemp);

-- AUTO MODE --

-- School Weekdays School at 7:00
while( 
    (cTime > '05:05' and cTime < '07:00') and (Global == 'ON') and (Home == 'HOME') and (cDate.wday==2 or cDate.wday ==3 or cDate.wday ==4 
        or cDate.wday ==5 or cDate.wday ==6) 
    ) do
    
    log("Current Temperature: "..FloorBathroomTemp);
    log("Previous Target Temperature: "..FloorBathroomTargetTemp);
    fibaro:setGlobal("Mode_FloorHeating", "AUTO")
  
if (FloorBathroomTemp < 24) then
    if (FloorBathroomTargetTemp ~= 30) then
        fibaro:call(262, "setThermostatSetpoint", "1", "30")
          fibaro:setGlobal("Bathroom_Heating", "ON") 
        log("New Target Temperature: "..FloorBathroomTargetTemp);
        log("Floor Heating ON"); 
        fibaro:sleep(2000);   
    elseif (FloorBathroomTemp >= 24) then 
        fibaro:call(262, "setThermostatSetpoint", "1", "23")
          fibaro:setGlobal("Bathroom_Heating", "OFF") 
        log("New Target Temperature: "..FloorBathroomTargetTemp);
        log("Floor Heating OFF"); 
        fibaro:sleep(2000);
    end
end
 

log("Wait 5 min for next measurement")
fibaro:sleep(300*1000); 
  
    fibaro:setGlobal("BathroomSetTemp", FloorBathroomTargetTemp);
    
    -- if manual adjusted while automode morning ON
    if (NewTemp ~= "30" or NewTemp ~= "23" ) then  
        fibaro:setGlobal("Mode_FloorHeating", "MANUAL")
        log("Manual Mode Enabled");
         goto stop
       end
  
    -- if nobody home and heating still ON
    if (Home == 'AWAY') then 
       log("Away Mode has been Enabled");
       fibaro:setGlobal("Mode_FloorHeating", "MANUAL")
       goto stop 
    end 
  
end


while( 
    (cTime > '07:00' and cTime < '09:30') and (Global == 'ON') and (Home == 'HOME') and (cDate.wday==7 or cDate.wday ==1 )     
    ) do
  
    log("Current Temperature: "..FloorBathroomTemp);
    log("Previous Target Temperature: "..FloorBathroomTargetTemp);
    fibaro:setGlobal("Mode_FloorHeating", "AUTO");
  
if (FloorBathroomTemp < 24) then
    if (FloorBathroomTargetTemp ~= 30) then
        fibaro:call(262, "setThermostatSetpoint", "1", "30");
          fibaro:setGlobal("Bathroom_Heating", "ON"); 
        log("New Target Temperature: "..FloorBathroomTargetTemp);
        log("Floor Heating ON"); 
        fibaro:sleep(2000);   
    elseif (FloorBathroomTemp >= 24) then 
        fibaro:call(262, "setThermostatSetpoint", "1", "23");
          fibaro:setGlobal("Bathroom_Heating", "OFF");
        log("New Target Temperature: "..FloorBathroomTargetTemp);
        log("Floor Heating OFF"); 
        fibaro:sleep(2000);
    end
end

log("Wait 5 min for next measurement-weekend")
fibaro:sleep(300*1000); 
  
fibaro:setGlobal("BathroomSetTemp", FloorBathroomTargetTemp);
    
    -- if manual adjusted while automode morning ON
    if (NewTemp ~= "30" or NewTemp ~= "23" ) then 
       fibaro:setGlobal("Mode_FloorHeating", "MANUAL")
       log("Manual Mode Enabled");
       goto stop
    end 
    -- if nobody home and heating still ON
    if (Home == 'AWAY') then
       log("Away Mode has been Enabled");
       fibaro:setGlobal("Mode_FloorHeating", "MANUAL")
       goto stop
    end 
end

::stop::

 

-- MANUAL MODE --

--log("Current Temperature: "..FloorBathroomTemp);
log("Target Temperature: "..FloorBathroomTargetTemp);
log("Saved Target Temperature: "..NewTemp);

 

-- Manual Mode = Sleep for 2hours then AUTO again
if (Mode == 'MANUAL') and (NewTemp ~= "30" or NewTemp ~= "23") then  
    log("Manual Mode for 2hrs");
    fibaro:sleep(120*60*1000); 
    fibaro:setGlobal("Mode_FloorHeating", "AUTO");
    fibaro:call(262, "setThermostatSetpoint", "1", "15")
end

 

-- after 7:00 or 9:30  the return to 15C
if (Mode == 'AUTO') and (NewTemp == "30" or NewTemp == "23") then
    fibaro:call(262, "setThermostatSetpoint", "1", "15")
    log("Auto Mode Enabled, Temperature set to 15 C");  
end

 

-- set Heating Variable ON or OFF...
if (FloorBathroomTargetTemp > FloorBathroomTemp) then
    fibaro:setGlobal("Bathroom_Heating", "ON");
    log("Floor Heating = ON");
else 
    fibaro:setGlobal("Bathroom_Heating", "OFF");
    log("Floor Heating = OFF"); 
end

  

Edited by samuel

Join the conversation

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

Guest
Reply to this topic...

×   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...