script does not update my sensor "temperatuur".
I made this script with
event: test3
dzVents
Timer. (but after saving it becomes devices automaticaly ?
I have this script working with lua, but i dont want it every minute but every hour.
Functionality
1. i read a station.sensor (buitentemperatuur), This station has two values, i need the first, the temperature
2. i read the temperature and put it in a temperature sensor "temperatuur"
3. If the value "temperatuur" is below 3 degrees celcius and warmtelint is off, warmtelint will be on (some kind of heater againt freezing the watersupply)
Code: Select all
return {
active = true,
on = {
timer = {'every 60 minutes'}
},
execute = function(domoticz)
local schakelaar = 'warmtelint' -- schakelaar van warmtelint
local sensortemp = 'Buitentemperatuur' -- sensor die de weergegevens ontvangt
local templimit = 3 -- tempwaarde onderwaarde
sTemp, sWeatherHumidity = otherdevices_svalues[sensortemp]:match("([^;]+);([^;]+);([^;]+)")
sTemp = tonumber(sTemp)
domoticz.temperatuur.temperature=sTemp -- set a sensor with only the temperature from sensor buitentemperatuur. Sensor buitentemperatuur is multi valued
if (sTemp) <= 3 then
-- temperatuur is onder de minimumwaarde
if (warmtelint.active) then
domoticz.log('Warmtelint stond al aan')
else
domoticz.devices(schakelaar).switchOn()
domoticz.log('Warmtelint aan')
end
else
-- temperatuur is boven of gelijk aan de minimumwaarde
if (warmtelint.active) then
domoticz.log('Warmtelint stond aan wordt nu uitgezet')
domoticz.devices(schakelaar).switchOff()
else
domoticz.log('Warmtelint was al uit')
end
end
end
}