Skip to content

Instantly share code, notes, and snippets.

@jlstanus
Last active January 20, 2022 12:19
Show Gist options
  • Save jlstanus/665ce5c76f7bdd2b5e7ade0e9dd71185 to your computer and use it in GitHub Desktop.
Save jlstanus/665ce5c76f7bdd2b5e7ade0e9dd71185 to your computer and use it in GitHub Desktop.
Domoticz - Gestion thermostat Netatmo - Danfoss
-- https://www.domoticz.com/wiki/Thermostat_control
-- commandArray['SetSetPoint:MySetPointIdx']='20.5' more here: https://www.domoticz.com/wiki/LUA_commands
--------------------------------
------ Start of edit section ------
--------------------------------
local hysteresis = 0.5 --Valeur seuil pour éviter que le relai ne cesse de commuter dans les 2 sens
local thermostat = 'Living Thermostat' --Nom de l'interrupteur virtuel du thermostat
local valve_sam_droite = string.format('SetSetPoint:%s', 43) --Nom du radiateur à allumer/éteindre
local valve_sam_gauche = string.format('SetSetPoint:%s', 41)
local valve_salon = string.format('SetSetPoint:%s', 121)
local valve_cuisine = string.format('SetSetPoint:%s', 0)
local valves = {valve_sam_droite, valve_sam_gauche, valve_salon}
--------------------------------
-- End of edit section --
--------------------------------
commandArray = {}
--Oregon sensor 'Salon' send temperature every 40s. This will be the execution frequency of this script.
if (devicechanged[thermostat]) then
local temperature = tonumber(otherdevices_svalues[thermostat]) --Temperature relevée dans le salon
--On n'agit que si le "Thermostat" est actif
print('-- Gestion du thermostat pour le salon --')
local temp_corr = tostring(temperature + hysteresis)
print(string.format('Temperature màj: %s', temp_corr))
for _, v in ipairs(valves) do
commandArray[v]=temp_corr
end
end
return commandArray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment