Code : Tout sélectionner
--
-- Domoticz passes information to scripts through a number of global tables
-- https://www.iot4.eu/wiki/index.php/Domoticz_smart_thermostat
local heating_probe = 'TempSlabTest' --Nom de la sonde temperature Dalle Beton
local thermostat_setpoint = 'Thermostat Slab' --Nom de l'Thermostat virtuel Temperature Dalle Beton
local heating_unit = 'Relay Slab Beton' --Nom de l'inter virtuel de Relay On/off Dz/Relais espeasy
local OnOff = 'Slab Heating' --Nom de l'inter virtuel de Marche Arret Automatique
local heating_probe_geo = 'TempGeoDummy' --Nom de la sonde temperature Geo Out
-- Use when a combined sensor (e.g. temperature and humidity) is used
-- Replace in "otherdevices[heating_probe]" to "otherdevices[heating_probe]" by "temp_only" (in the 2nd "if" and in the "elseif".
-- Remove the -- in the next two lines:
--local naartekst = (tostring (otherdevices[heating_probe]))
--local temp_only = (string.sub(naartekst,1,4)) -- the digits (1,4) do point out what characters of the string are needed.
local hysteresis = 0.5
commandArray = {}
if (otherdevices[OnOff]=='On') then
-- loop through all the devices
for deviceName,deviceValue in pairs(otherdevices) do
if (deviceName== thermostat_setpoint ) then
if tonumber(deviceValue) < tonumber(otherdevices[heating_probe]-hysteresis) then
if (otherdevices[heating_unit] == "On") then
-- commandArray['SendNotification']='Heating is off'
commandArray[heating_unit]='Off'
print("Heating is Off")
end
elseif tonumber(deviceValue) > tonumber(otherdevices[heating_probe]+hysteresis) then
if (otherdevices[heating_unit] == "Off") then
commandArray[heating_unit]='On'
-- commandArray['SendNotification']='Heating is on'
print("Heating is On")
end
end
end
end
-- loop through all the variables
for variableName,variableValue in pairs(uservariables) do
end
end
return commandArrayEdit: pour le on/off j'ai ajouter un
en dessous du commandArray et end a la fin, ça fonctionne excepter que si la consigne de chauffage est en marche et j’arrête mon script (off) la chauffe continue, comment je fait pour re-evalué ou ..... pour que ça marche.if (otherdevices[OnOff]=='On') then