LUA, send email when Temperature is high
-
I am using this script to detect if the drawer is open for my "TV-electronics". My kids start PS3 but forget to open the drawer. That's why I made this
Create a user variable named "AppleTVVarm", of course you can name it to what you like but use my names first then after you tested it and it works you can change the names. Device name must be change to your device name If variable is 1 it means that the temperature has reached its limit.
If the temperature get above 35 it will send me an email and when it goes below 30 it will send a new email, so I know it gets cooled down.
Varm means Warm
Sval means coolcommandArray = {} local function update(cmd) if devicechanged[cmd] then local vari = "Variable:" .. cmd .. "Varm" --add Varibale: before device and Varm after device local varm = cmd .. "Varm" --add Varm after device --print(cmd) --print(varm) --print(vari) temperature = tonumber(devicechanged[''..cmd..'_Temperature']) --read temperature from device, if device have more than only temperature if (temperature > 35) and (uservariables[varm] == 0) then --if temperature is above 35 for the first time commandArray['SendEmail']=''..cmd..' varm#""#abc@hotmail.com' --send email commandArray[vari] = "1" --set variable to 1 end if (temperature < 30) and (uservariables[varm] == 1) then --if temperature is below 30 commandArray['SendEmail']=''..cmd..' sval#""#abc@hotmail.com' --send email commandArray[vari] = "0" --set variable to 0 end end end update ('AppleTV') --device to read temperature from update ('PS3') update ('Stereo') return commandArray
copy the code and create a new script in Domoticz, select LUA and Device otherwise it will not work
1 out of 1
Suggested Topics
-
Vera Gateway Versions
Troubleshooting • 29 Mar 2014, 19:59 • karenbobiv 30 Mar 2014, 07:20 -
Blockley in Domoticz-not working correctly. Anyone know how to fix.... ?
Domoticz • 15 Nov 2021, 23:07 • Bren 21 Nov 2021, 18:09 -
Calculate Delta T of two temperature sensors with lua
Domoticz • 5 Oct 2022, 10:06 • Mela 5 Oct 2022, 10:06 -
domoticz tables and mysensors
Domoticz • 7 Feb 2023, 20:55 • ebioz 7 Feb 2023, 20:55 -
Trying to automate in Domoticz
Domoticz • 25 Feb 2022, 23:13 • Feliw05 28 Feb 2022, 03:39