je souhaite ajouter un capteur Fibaro dans mon script "voir ci-dessous" il me sert à gérer le chauffage de la chambre de ma fille en fonction de la température de la pièce... il fonctionne très bien, mais je souhaite passer une étape en ajoutant une condition si la fenêtre est ouverte....
Code : Tout sélectionner
local temp = 'Température chambre Lihore'
local thermostat_setpoint = 'Thermostat Lihore'
local heating_unit = 'Ventilateur Chauffage Lihore'
local hysteresis = 0.5
commandArray = {}
if devicechanged[temp] then
print('temp:'..otherdevices_temperature[temp])
print('thermostat_setpoint:'..otherdevices[thermostat_setpoint])
if tonumber(otherdevices[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[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 commandArrayCode : Tout sélectionner
local temp = 'Température chambre Lihore'
local thermostat_setpoint = 'Thermostat Lihore'
local heating_unit = 'Ventilateur Chauffage Lihore'
local windows_lihore = 'Capteur Fenêtre Lihore'
local hysteresis = 0.5
commandArray = {}
if devicechanged[temp] then
print('temp:'..otherdevices_temperature[temp])
print('thermostat_setpoint:'..otherdevices[thermostat_setpoint])
print('windows_lihore:'..otherdevices[windows_lihore])
if tonumber(otherdevices[thermostat_setpoint]) < tonumber(otherdevices_temperature[temp]-hysteresis) then
if (otherdevices[heating_unit] == "On") then
if(otherdevice[windows_lihore] == "On") then
commandArray[heating_unit]='Off'
print("Heating is Off")
end
elseif tonumber(otherdevices[thermostat_setpoint]) > tonumber(otherdevices_temperature[temp]+hysteresis) then
if (otherdevices[heating_unit] == "Off") then
if (otherdevices[windows_lihore] == "Off") then
commandArray[heating_unit]='On'
print("Heating is On")
end
end
end
end
return commandArrayCode : Tout sélectionner
2020-04-05 23:49:37.120 Error: EventSystem: in Test gestion chauffage chambre Lihore V2.0: [string "local temp = 'Température chambre Lihore' ..."]:30: 'end' expected (to close 'if' at line 11) near <eof>
Quelqu'un peux m'aider ?
Merci d'avance à tous