Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Controllers
  3. Domoticz
  4. LUA, send email when Temperature is high

LUA, send email when Temperature is high

Scheduled Pinned Locked Moved Domoticz
1 Posts 1 Posters 3.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    flopp
    wrote on last edited by flopp
    #1

    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 cool

    commandArray = {}
    
    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 Reply Last reply
    2
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    16

    Online

    11.7k

    Users

    11.2k

    Topics

    113.1k

    Posts


    Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • MySensors
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular