[SOLVED] Best way to send SMS

Hi.
I guess this has been discussed before, but I don’t find any good answers… I want my OH system so be able to send me a SMS when things go wrong. I don’t want any extra hardware for this so I’m planning to use some thirt party service with a web api, for example I’ve been looking at Nexmo and Clickatell. Of course I realize that this means it can’t send SMS if the network is down, but I’m more talking about smaller problems (like automower is stuck or some sensor doesn’t seem to communicate). What is the best way to do this in OH? Exec binding calling a bash script?

1 Like

I would say: IFTTT integration via http://www.myopenhab.org/

I would also recommend email notifications instead of SMS :slight_smile:

1 Like

Indeed You can IFTTT send you SMS, but I think that is limited to 10/week. But that might be sufficient for @DanielMalmgren’s purpose

But other than that I agree about the email. I use email notification, which comes in practically immediately on my smartphone, as a notification. On top of that I have IFTTT send me a notification for emails … which comes a bit later.

I know, for email you need to be in contact with a network and for SMS you dont, but if 10/week covers yr needs @DanielMalmgren I’d go for IFTTT

Anyway, just tried again with a tripwire, email notification comes in the moment the wire is tripped.

1 Like

I’m using an online service. It’s possible to buy a number of sms and they offer API that I use via OH.

If your SMS provider provides an email gateway that can offer a solution…still needs to be connected to the net.

Well, I am already sending mail. Problem is they’re drowning in my other mail, a sms would do a lot better job of catching my attention when it’s needed. Also setting up IFTTT and connection to myopenhab.org sounds like kinda overkill just to send a sms. Trying to get dependencies on third party cloud stuff down to a minimum here…

But the ones of you that use online services, how do you call them from OH?

push the notifications to slack (…i know… overkill :slight_smile:)




You can send SMS if you plug in an UTMS stick with a mobile sim. These does not need an online service.

Edit: I just saw you don’t want extra hardware, so this is not what you want. UMTS stick are not so expensive, though.

Hi, i think going for Slack is the best approach.

I see these approaches without purchasing hardware:

  • Search on he web for a free sms gateway which offers service in your country with “REST” functionality, which also has a developer access with limited amounts of free sms.
  • Use an instant messenger API like Google Hangouts or Telegram (which also has a Bot API https://core.telegram.org/bots/api#available-methods).
  • Set up your own instant messenger service at home with xampp (jabber)
  • If you have the mindset “keep cloud stuff and 3rd party stuff out as much as possible and use old stable, well known stuff which doesn’t have a lot of protocol changes” and you have problems with your mail provider, you can still set up your own mailserver (dovecot and postfix) and send mails around which pop up on the phone. You don’t need additional software on the phone cause usually every smartphone has an email app.

Just for clarification sending SMS is basically using a 3rd party provider (your mobile phone company) to deliver your messages, so not wanting to use one is not an argument :wink:

1 Like

Hi.
Thanks for all input! I’m sorry though, but nobody really answers the question. I want to send SMS, not anything else.

I ended up registering an account at Nexmo and putting together a solution according to my initial suggestion. I’d just like to document it here for the completeness :slight_smile:

I installed the exec binding and made the following files. Works like a charm:

root@cube:/etc/openhab2# cat things/exec.things
Thing exec:command:sendsms [command="/usr/local/bin/sendnexmosms %2$s", autorun=true, interval=0]
root@cube:/etc/openhab2# cat items/exec.items
String smstext "[%s]" (All) {channel="exec:command:sendsms:input"}
root@cube:/etc/openhab2# cat /usr/local/bin/sendnexmosms
#!/bin/sh
curl -X POST  https://rest.nexmo.com/sms/json -d api_key=<hidden> -d api_secret=<hidden> -d to=<hidden> -d from="openHAB" -d text="$*"
root@cube:/etc/openhab2#
1 Like

@DanielMalmgren could you please also show your rules to see how do create the SMS message and use the exec binding .
Thanks

1 Like

I haven’t started making the rules yet :smile:

This far I’ve confirmed I can send sms by the following in Karaf:

 smarthome:send smstext "This is a test"

I’ll get back when I have some rule examples to show :wink:

Hmmmm, this is weird. I decided to drop the autoraun and instead bind a Switch item to the run channel to get more control of when the sms is sent. And it works in the sense that the command is run then I change the item to “ON”. The weird thing though is that the sms I get still contains the old text. So whatever I now change the String item to, the argument sent to the command always contain the value that the item had before I disabled autorun. Wtf?

We want to advise other users who are reading this… not to use SMS since it is an outdated solution and there are better ways to send notifications (e.g. email) :slight_smile:

Good luck with your wtf-SMSes :stuck_out_tongue:

Trying not to start a fight here, but it’s hardly up to you to decide what is best for all users in all scenarios. SMS have some huge advantages:

  • They work on all phones
  • They work without any configuration or extra installation
  • On my phone I have the sms app configured to make a sound when I get a sms, not when I get a mail, so they are much more likely to catch my attention

So instead of judging what I should or should not do, or try to steer me into something that in no way fulfills my needs, could you please try to help? I’ve been experimenting back and forth now and obviously something is not right with the exec binding, just can’t find the culprit.

3 Likes

I think several people did tell you how to send SMS and additionally gave other possibilities.
That you didnt like any of the possibilties is ofcourse your prerogative, but you were given sms solutions.
Anyway, water under the bridge, I am happy you found Nexmo to work for you and thanks for that feedback

@DanielMalmgren
I had this sort of thing working in OH1 but haven’t finished migrating to OH2 yet.
I was using a python script to call the provider API, and exec binding to send the parameters to the python script. It seemed to work well.

Hope you get it working! :slight_smile:

Check at your cellular provider, T-Mobile delivers (adware) gateway wit API accessible by http ie:

Just ask your provider

How is the string Item getting changed? How is that synchronized to however the command is run now? We don’t have a very clear view of what you are doing.

I too am not a fan of email for notifications. In fact I have notifications for email turned off. I just don’t get anything in my (personal) email that is important enough. Plus I try to keep notifications to a minimum anyway.

Personally I’ve been using Prowl for non critical notifications, but am considering trying out Pushover.

Since you specifically want SMS, I think your best bet is an email to SMS gateway as others have mentioned. Most carriers provide one. Here’s a list of gateways https://martinfitzpatrick.name/list-of-email-to-sms-gateways/
This is what I would use in addition to a push service for critical notifications.

1 Like