No announcement yet.

Send SMS via event script

  • Filter
  • Time
  • Show
Clear All
new posts

    Send SMS via event script

    I didn't want to buy a modem just to send TXT messages from HS3 on linux to my mobile phone so I wrote a C# script to use SMS service and the "curl" program to do it.
    To use Twillow you have to setup an account (free trial with web setup) and buy a sending phone number ($1.00/month after trial) and outgoing messages cost $.007/each after trial period.
    The script needs to be edited to insert Twillow account info and phone numbers. Instructions are in the script. Then just run the script on an event and provide the message text in the script parameter which can include replacement variables.
    I've attached the zip file of the script. Just unzip and put in HomeSeer scripts directory and edit account info.
    Attached Files

    Thanks so much for this. I was looking for some examples how to send an SMS using Twilio's API.

    Quick question though, when I try running the script on my machine, I get the following error:

    "Running script C:\Program Files (x86)\HomeSeer HS3\scripts\SendSMS.cs :The system cannot find the file specified"

    Do I need to add any imports reference or similar for this?

    Thanks in advance


      I get the same messae. I am assuming it cannot find the curl program to run. stay tuned.


        I tried it on my linux HS machine and no issues at all, the c# script works flawlessly.


          I only tested on Linux HS3 but Rylo is probably correct for Windows users. You can install "curl" on windows - see:


            I will try that out. Thanks


              If there Ian enough demand I'd be happy to add Twillio support to the plugin. Most users use the plugin as a backup notification method when the Internet is down so Twillio becomes inaccessible.

              Also outside the USA Twillio becomes quite pricey and often will not offer local numbers so replies / inbound messages become expensive too.
              Author of Highpeak Plugins | SMS-Gateway Plugin | Blue Iris Plugin | Paradox (Beta) Plugin | Modbus Plugin | Yamaha Plugin


                Thanks for the reply,

                That makes sense, I was not aware the Twilio charges are that much higher in other countries. My local is Canada so the fees are very similar to those in the US.

                At this point I am happy with the C# script created by @ksg that sends a message.

                I am looking into the external modem solution with the SMS plugin, but I require a 3G modem as there is no GSM or 2G coverage in my area.


                  @Rylo, were you able to resolve the c# error when the script is ran? I installed curl and updated the system paths. The curl checks out (able to execute a test from the command prompt) so I know that is OK. I just still get the same error log.



                    OK, fixed the issue.

                    1) Make sure the curl library is installed correctly. I also had a curl ssl issue with the .crt and .perm files. I had to place a copy of them in my windows folder.

                    2) The way curl quotations work in windows is different than those in linux. Using single quotations ( ' ) in windows caused a number issues with the curl.exe shell. By replacing the single quotations in the .cs script with double quotations ( " ) I was able to get the script running fine. I have attached a copy of the .cs script that I was able to get working. Thanks again to @ksg for making this script.
                    Attached Files
                    Last edited by adamg; September 14, 2017, 04:13 AM. Reason: Resolved issue.


                      just use email to send text message

                      If you know what carrier the phone is on, then consider simply sending an email to the phone number 7=digit phone number and my carrier's address.

                      Here is a list of common wireless carriers in the US:
                      Alltel: (or for picture messages)
                      Verizon: (or for photos and video)

                      The email capability provided as part of an HS event will accomplish this.
                      If you phone number is 123-456-7890, and your carrier is Verizon, then the email address is

                      You can even embed device values, date and time in the message. For example,
                      WARNING -- Hot tub temperature is lower than usual
                      $date $time :: Hot Tub 1-wire Temp = $$DSR:161: