I currently have a working script that sends an email to my wife if the temp goes over a certain value and runs every hour. It works fine but i'd like to include the actual temp in the email if possible? This is my current code for testing it but it's not working, i'm sure someone will know where i've gone wrong.
return {
on = {
timer = { 'every minute between 12:00 and 22:00'
}
},
execute = function(domoticz, )
if (domoticz.devices ('Temperature').temperature > 20) then
domoticz.email('Hi Prue you may turn the Aircon on because the temp is:' .. 'Temperature'.temperature '', '*****@gmail.com')
end
end
}
welby wrote: ↑Wednesday 31 January 2018 7:51
I currently have a working script that sends an email to my wife if the temp goes over a certain value and runs every hour. It works fine but i'd like to include the actual temp in the email if possible? This is my current code for testing it but it's not working, i'm sure someone will know where i've gone wrong.
return {
on = {
timer = { 'every minute between 12:00 and 22:00'
}
},
execute = function(domoticz, )
if (domoticz.devices ('Temperature').temperature > 20) then
domoticz.email('Hi Prue you may turn the Aircon on because the temp is:' .. 'Temperature'.temperature '', '*****@gmail.com')
end
end
}
There are some other minor syntax errors in your example please find corrected below
--[[
Email test
]]
return {
on = {
timer = { 'every minute between 12:00 and 22:00'
}
},
execute = function(domoticz)
local myTemp = domoticz.devices ('Kantoor').temperature
if myTemp < 20 then
print ("Sending mail")
domoticz.email("Temperature alert for Prue", "Hi Prue you may turn the Aircon on because the temp is: " .. tostring(myTemp), "[email protected]")
end
end
}