Je souhaite automatiser mon ventilateur en fonction de 3 choses :
- S’il fait jour
- Si l’interrupteur commandé par géolocalisation de mon téléphone est “on”
- S’il fait plus de 25 degrés
J’ai fait une tentative… sans succès…
Je vous mets mon code bancal :
Code : Tout sélectionner
return {
on = {
devices = { 'iPhone' },
},
execute = function(domoticz, item)
if item.active then
if domoticz.time.isDayTime then
domoticz.devices('Ventilo').switchOn().checkFirst()
end
local Sensor = domoticz.devices('TempInt')
if Sensor.temperature >= 25 then
domoticz.devices('Ventilo').switchOn().checkFirst()
end
else domoticz.devices('Ventilo').switchOff().checkFirst()
end
end
}Ciao