Author Topic: Sending SMS within luup code  (Read 3414 times)

Offline usmampoer

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
Sending SMS within luup code
« on: September 28, 2011, 11:46:33 am »
I have searched the knowledge base but I cannot find a luup command to send a SMS notification. I would like to create a scene and when an event is triggered like a door open, I would like to wait 5 secs and if not closed send a SMS notification through Luup.

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
Re: Sending SMS within luup code
« Reply #1 on: September 28, 2011, 12:35:52 pm »
You could use SND (http://forum.micasaverde.com/index.php?topic=6656.0) and an email-to-SMS gateway ...

Offline myhomeserver

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 873
  • Karma: +3/-5
  • http://www.MyZwave.net
Re: Sending SMS within luup code
« Reply #2 on: September 28, 2011, 01:25:36 pm »
This is what I have in my LUUP tab when I create a scene, and it works great.  I use the TZO.COM OMR (outbound mail relay) service to send out my mail since I don't run my own server and my ISP has blocked port 25 outbound in the past. 


-----------------------------------BEGIN CODE--------------------------------------

 
local smtp = require("socket.smtp")

        local SMTP_SERVER = "omr.tzo.com"
        local SMTP_PORT = "2525"
        local USER_SENDING = "<user@example.comt>"
        local USER_RECEIVING = "<user@example.com>"

        local from = USER_SENDING
        local rcpt = {USER_RECEIVING}

        local mesgt = {
            headers = {
                to = USER_RECEIVING,
                subject = "SUBJECT GOES HERE"
            },
            body = "BODY OF EMAIL"  .. os.date("%c")
        }

        local r, e = smtp.send{
            from = from,
            rcpt = rcpt,
            source = smtp.message(mesgt),
            server = SMTP_SERVER,
            port = SMTP_PORT,
          }

        if (e) then
            luup.log("Yikes " ..  e)
        end

MyZWave.net - See Our Z-Wave product Reviews
(formerly MyHomeServer)

Offline usmampoer

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
Re: Sending SMS within luup code
« Reply #3 on: September 30, 2011, 11:57:33 am »
Great thanks for the support I will try this, I just thought that there is an easier way to programatically  use the notifications that are already on the dashboard on the vera..