Page 2 sur 2

Re: Thermostat sur Domoticz

Publié : 25 mars 2020, 08:40
par vil1driver
Salut,

Ta sonde ne doit pas relever l'humidité.
Temp_only = température seulement

Re: Thermostat sur Domoticz

Publié : 25 mars 2020, 08:53
par Cedric59
Salut vil1driver c'est déjà le cas

2020-03-25 07:14:01.413 Status: LUA: temp_only:23.10;36.00;0

ou je em trompe ?

Re: Thermostat sur Domoticz

Publié : 25 mars 2020, 10:59
par vil1driver
Pour toi ceci est une température ?
23.10;36.00;0

Re: Thermostat sur Domoticz

Publié : 25 mars 2020, 13:05
par Cedric59
@vil1driver vue comme cela tu as raison mais dans le code c'est déjà indiqué temp_only

Code : Tout sélectionner

local temp_only = 'Température chambre Lihore' 
local thermostat_setpoint = 'Test thermostat'
local heating_unit = 'Ventilateur Chauffage Lihore'


local hysteresis = 0.5

commandArray = {}

if devicechanged[temp_only] then
--for deviceName,deviceValue in pairs(otherdevices) do
    --if (deviceName== thermostat_setpoint) then
		print('temp_only:'..otherdevices[temp_only])
		print('thermostat_setpoint:'..otherdevices[thermostat_setpoint])
        if tonumber(deviceValue) < tonumber(otherdevices[temp_only]-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[temp_only]+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

return commandArray

Re: Thermostat sur Domoticz

Publié : 25 mars 2020, 13:55
par vil1driver
ça signifie que tu dois fournir une température uniquement une température, pas un truc avec humidité incluse.
essai comme ceci, ça devrait aller

Code : Tout sélectionner

local temp = 'Température chambre Lihore' 
local thermostat_setpoint = 'Test thermostat'
local heating_unit = 'Ventilateur Chauffage Lihore'


local hysteresis = 0.5

commandArray = {}

if devicechanged[temp] then
		print('temp:'..otherdevices_temperature[temp])
		print('thermostat_setpoint:'..otherdevices_svalues[thermostat_setpoint])
        if tonumber(otherdevices_svalues[thermostat_setpoint]) < tonumber(otherdevices_temperature[temp]-hysteresis) then
            if (otherdevices[heating_unit] == "On") then
                commandArray[heating_unit]='Off'
                print("Heating is Off")
            end
        elseif tonumber(otherdevices_svalues[thermostat_setpoint]) > tonumber(otherdevices_temperature[temp]+hysteresis) then
            if (otherdevices[heating_unit] == "Off") then
                commandArray[heating_unit]='On'
                print("Heating is On")
            end
        end
end

return commandArray

Re: Thermostat sur Domoticz

Publié : 25 mars 2020, 18:10
par denis_brasseur
Cedric59 a écrit : 25 mars 2020, 13:05 @vil1driver vue comme cela tu as raison mais dans le code c'est déjà indiqué temp_only

Code : Tout sélectionner

local temp_only = 'Température chambre Lihore'
Ce n'est pas parce que la variable s'appelle temp_only qu'elle ne va remonter que la température, mais bien quelle ne doit remonter que la température.
D’où l’intérêt d'afficher les valeurs de la sonde pour comprendre l'erreur.

Re: Thermostat sur Domoticz

Publié : 25 mars 2020, 19:36
par Cedric59
Super vil1driver ça fonctionne.

tu sais m'expliquer pourquoi avec temp sa à fonctionné contrairement à temp_only

Un merci aussi à Denis pour son aide.

Un merci à vous deux pour votre patience :D

Re: Thermostat sur Domoticz

Publié : 25 mars 2020, 19:54
par vil1driver
J'ai modifié temp_only en temp pour être en cohérence avec le reste du code.
Code dans lequel j'ai fait en sorte de n'extraire que la température de ton device.
J'ai également modifié la façon d'obtenir la consigne.
Je te laisse le soin de faire les comparaisons

Re: Thermostat sur Domoticz

Publié : 25 mars 2020, 20:40
par Cedric59
Merci