Hi guys, I see out there a lot of services for notifications via SMS for HA. Some of them also allow to receive incoming SMS. But I’m not sure how to choose among them, and which hardware I need to buy.
Basically, I want to periodically send an SMS with the current status of my sensors, and also when an alarm is raised. This could be easily done with the automation (currently I’m using pushbullet).
But what about the parsing? I’m interested to receive basic commands to control lights and heaters but allowing to put more commands inside a single SMS with some parameters. Example:
GARDEN ON; STOVE 24; BOILER OFF
What service would you recommend? And which hardware?
I was mainly interested in SMS notifications as a backup notification system in the event we had a network issue or were overseas without data coverage.
I opted for the GSM modem integration and have settled on using a vintage unlocked Huawei E220 (from eBay) which does properly support receiving SMS - the Huawei E3531 I started out with does not support receiving due to a gammu bug.
There’s a (large) thread about the integration here.
Regarding inbound SMS I only check for a couple of numbers and against some content, although I’ll be expanding this when I switch our alarm system to a GSM dialler (from landline) and use HA to keep the alarm SIM’s account active with monthly status report requests.
The below automation is what I’m currently using - valid numbers for (redacted) people are held in the secrets.yaml file and loaded into template sensors for matching:
# receiving SMS messages
# data: phone, date, text
# log receipt, record date and act on specific valid triggers.
- id: sms_received
alias: "SMS Received"
mode: queued
trigger:
- platform: event
event_type: sms.incoming_sms
condition: []
action:
# log who the message is from and the content
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.event.data.phone == states('sensor.sms_one') }}"
sequence:
- service: logbook.log
data:
entity_id: automation.sms_received
name: "SMS Received from One: "
message: "{{ trigger.event.data.text }}"
domain: automation
- conditions:
- condition: template
value_template: "{{ trigger.event.data.phone == states('sensor.sms_two') }}"
sequence:
- service: logbook.log
data:
entity_id: automation.sms_received
name: "SMS Received from Two: "
message: "{{ trigger.event.data.text }}"
domain: automation
- conditions:
- condition: template
value_template: "{{ trigger.event.data.phone == states('sensor.sms_homealarm') }}"
sequence:
- service: logbook.log
data:
entity_id: automation.sms_received
name: "SMS Received from Home Alarm Panel: "
message: "{{ trigger.event.data.text }}"
domain: automation
default:
- service: logbook.log
data:
entity_id: automation.sms_received
name: "SMS Received from {{ trigger.event.data.phone }}: "
message: "{{ trigger.event.data.text }}"
domain: automation
# record time and date of last message received
- service: input_datetime.set_datetime
data:
entity_id: input_datetime.last_sms_received
time: "{{ (as_timestamp(now()) | timestamp_custom('%H:%M:%S', true)) }}"
date: "{{ (as_timestamp(now()) | timestamp_custom('%Y-%m-%d', true)) }}"
# act on specific message triggers from valid people
- choose:
- conditions:
# test of sms notifications requested by valid person.
- condition: and
conditions:
- condition: template
value_template: "{{ trigger.event.data.phone == states('sensor.sms_one') or trigger.event.data.phone == states('sensor.sms_two') }}"
- condition: template
value_template: "{{ trigger.event.data.text.strip().lower() in ['check sms', 'test sms'] }}"
sequence:
- service: >
{% if trigger.event.data.phone == states('sensor.sms_one') %}
notify.sms_one
{% else %}
notify.sms_two
{% endif %}
data:
message: "SMS notifications check as requested at {{ (as_timestamp(now()) | timestamp_custom('%d-%b-%y %H:%M', true)) }}."
- service: input_datetime.set_datetime
data:
entity_id: input_datetime.last_sms_sent
time: "{{ (as_timestamp(now()) | timestamp_custom('%H:%M:%S', true)) }}"
date: "{{ (as_timestamp(now()) | timestamp_custom('%Y-%m-%d', true)) }}"
- service: logbook.log
data:
entity_id: automation.sms_outbound_test
name: "SMS outbound test "
message: "successful"
domain: automation
Not to derail this thread, but I spent some time testing on my venv install before switching from the unlocked E3531 and believe I ran into https://github.com/gammu/gammu/issues/369 after exhausting other avenues (interface differences, etc).
Given that I was able to get the E220 up and receiving in minutes I am curious as to what is different about my environment / stick that gave me problems if you are able to receive out of the box.
Not sure if you want to send and/or receive outside standard broadband connection on a mobile network.
A few years back I used twilio (https://www.twilio.com/sms) to send sms from broadband to mobiles with good success. I do believe they have the ability to receive sms sent to a mobile number over broadband with their api’s as well. And may have a SIM card based solutions for operating on a mobile network. My use of sending SMS messages was affordable for the small number of message per month (10’s) I was doing.
Thanks, I’m going to use a lot more SMS. I know twilio but I was wondering if HA has a native way to handle this feature, without use external (commercial) services.
I did not think there was ‘free lunch’ with using SMS. Don’t you have to buy a SIM plan of some kind of a internet software/api service like twillo? The SIM route seems to have the positives of being a independent route from your broadband, so you could use it of broadband is out. Negative is that you have to purchase and maintain a hardware component. Also, SMS is pretty ubiquitous as flies under the blue vs. green of iOS vs. Android messaging (and works with basically no client app and for those ‘feature phone’ people too )
I’ve not used, but have you looked at the Telegram integration with HA? Seems pretty powerful, but IP based and needing a client.
On the just notification perspective. I have been using Pushover integration with HA with very good success for just notification of important events. Maybe Pushbullet has this now as well, but what I like about Pushover (am only focused on delivering to iOS clients) is Pushover’s ability to send iOS Critical alerts. As you probably know these notify on iOS even if the device is on do not disturb or silent. Good for water leaks and other emergency events.
Don’t you have to buy a SIM plan of some kind of a internet software/api service like twillo?
SIM plan of course, but why it’s mandatory to buy a software/api service? If HA can at least raise an event with the message content any simple scripting can parse a predefined set of messages syntax.
I’ve not used, but have you looked at the Telegram integration with HA? Seems pretty powerful, but IP based and needing a client.
My goal is to have a way to receive notification AND send commands to HA when I don’t have Internet access, but only GSM coverage.
I’m going to find out the most compatible GSM modem for HA (perhaps the Huawei E220 suggested, but if anyone has other hints they are welcome!) and try to manually parse the incoming messages. Should I fail I will definitely buy a plan from twilio.
I am new to HA, but I just want to chime in with what info I can. I’ve sent a few test SMS messages while I build my system and it seems that Twilio SMS costs $0.01 per message.The SIM card “starter pack” cost me $10 and it came with three SIMs (only need one though, at least for now). Monthly SIM fee is $2 and monthly phone number rental fee is $1. So, you’re looking at about $4 USD per month if you send 100 SMS per month.
Found this only now, thanks for sharing this. Sorry to revive the topic, but I wondered how you’ve setup the notify services for this, if I may ask? Can’t seem to figure this out for myself:
But there doesn’t appear to be a service called notify.sms_one. Also should recipient: become target: or am I overlooking something else here? Any help is very much appreciated.
The integration has moved on since my last post in this thread, so (assuming you’re screening received messages for authorized numbers you could simply set target to trigger.event.data.phone I think based on the current docs SMS notifications via GSM-modem - Home Assistant