The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: Text messaging from web url



Alex,

I would suggest using a function in a HS script, this could be called from
other HS scripts or as a one-liner and saves the overhead of a plugin.

Something like this should work. Just save it as a text file called sms.txt
in
your HS scripts directory.

Justin.

'******************************************************************
'Script to send SMS messages using the sendmytxt.com service

'Call this function from your scripts or as a one-liner like this:
'hs.RunEx "sms.txt","SMS","RECIPIENT
NUMBER","TXTMESSAGE"
'e.g. hs.RunEx "sms.txt","sms","123456789,Hello
World"

Function sms(Params)

Dim MyMobileNum, PIN, Recipient, Message, host, page

SMSinfo = Split(Params,",")

Recipient = Trim(SMSinfo(0))
Message = replace(SMSinfo(1)," ","&")

PIN = "12345"			'Your sendmytxt.com PIN goes here
MyMobileNum = "123456789"	'The mobile number you registered goes
here

host = "sendmytxt.com"
page = "/app/httpsend.asp?"
page = page & "from=" & MyMobileNum &
"&to=" & Recipient & "&pin=" & PIN
page = page & "&message=" & Message
strip_tags = false 'true
port = 80


Result = Trim(hs.GetURL(host, page, strip_tags, port))

Select Case Result

Case  "0" ReturnVal = "No from number or pin entered"
Case "-1" Returnval = "from number not a registered
user"
Case "-2" ReturnVal = "incorrect pin"
Case "-3" ReturnVal = "account suspended"
Case "-4" ReturnVal = "insufficient credits"
Case "-5" ReturnVal = "message sending failed"
Case "-6" ReturnVal = "format of to number not
recognised"
Case "-7" ReturnVal = "format of from number not
recognised"
Case Else ReturnVal = "Unknown error"

End Select

hs.writelog "SMS Info", "Sending message to: " &
Recipient
hs.writelog "SMS Info", "Message reads: " &
Replace(Message,"&"," ")
hs.writelog "SMS Info", "Service response: " &
ReturnVal

sms = ReturnVal
End Function

'***********************************************************************


Quoting kinchyuk <alex@xxxxxxx>:

>
> Justin,
>
> If you fancy modifying your app to interface to the sendmytxt http
> sending app (see my previous email) I'll be happy to put some free
> credits on your account. I've got HomeSeer too so can test it from
> this end.
>
> Alex
>
> --- In ukha_d@xxxxxxx, Justin <justin@g...> wrote:
> > Paul,
> >
> > have you seen my old Nokia, PAYG SIM, HomeSeer, solution?
> >
> > http://tinyurl.com/ftdi
> >
> > Certainly more reliable than some of the online offerings, 2 way
> SMS and it is
> > cheaper than a GSM modem.
> > Additionally, using my HS Commander plugin, it is possible to
have
> other
> > machines on a LAN send text messages as well.
> >
> > I chose this route as:
> >
> > I can send and receive text messages, even if net connection is
> down.
> >
> > Notification of power failure as HA PC is on UPS (which talks to
> HomeSeer) and
> > the phone obviously has a battery.
> >
> > Burglar alarm notification, even if power and phone lines are
out.
> >
> >
> > Justin.


Home | Main Index | Thread Index

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.