Skip to content

Instantly share code, notes, and snippets.

@clegendre
Last active January 29, 2016 20:51
Show Gist options
  • Save clegendre/b09b542e4a00739525af to your computer and use it in GitHub Desktop.
Save clegendre/b09b542e4a00739525af to your computer and use it in GitHub Desktop.
--[[
%% properties
10 value
28 value
%% globals
ChauffeSalon
--]]
local tempSalonDevice = 10;
local tempSalonDeviceNetatmo = 28;
local hysteresis = 1;
local desiredTemp = tonumber( fibaro:getGlobalValue("ChauffeSalon") );
local tempSalon = ( tonumber(fibaro:getValue(tempSalonDevice, "value") ) + tonumber(fibaro:getValue(tempSalonDeviceNetatmo, "value") ) ) / 2;
if( tempSalon > (desiredTemp + hysteresis/2) ) then
fibaro:debug("Temperature "..tempSalon.."° is higher than the desired one ".. desiredTemp.."°");
fibaro:debug("Turn off heating");
fibaro:call(97, "setMode", "0");
end
if( tempSalon < desiredTemp ) then
fibaro:debug("Temperature "..tempSalon.."° is lower than the desired one ".. desiredTemp.."°");
fibaro:debug("Turn on heating");
fibaro:call(95, "setThermostatSetpoint", "1", desiredTemp + hysteresis);
fibaro:call(97, "setMode", "1");
fibaro:call(98, "setFanMode", "4");
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment