Receive SMS in HA?

Hi,

Is there any way that HA can receive SMS?

Problem:
I have a GSM/SMS controlled receiver that starts the diesel heater in my car.
DANHAG Parkheater control

The following SMS command can be sent to the receiver.
INFO Query of current settings
TEMP Query the temperature
ON switches the heater on
ON:20 switches the heater on for 20 minutes
OFF switches the heater off
START0630 Timer function e.g.: heater starts at 6:30 am
STOP switches the heater off and deletes the timer
GPS Query of the last known GPS-position
XGPS Query of the current GPS-position

I receive status by receiving SMS showing status of the heater. If this could be implemented in my HA I would only need wifi connection to my phone to activate the heater through HA.
Today I must have GSM coverage on my phone to be able to operate the heater.

Any thoughts?

/Per

I see HA can already send SMS with ClickSend. The ClickSend service can also receive SMS.

Somebody would likely just need to extend the current HA module to include the receiving API calls.

Thats great! Did not know that.
I don’t think I am the only one looking to receive SMS.

I have no clue how to create an API to receive SMS through ClickSend.
I there anyone that know? Already have?
Search around but haven’t seen any solution yet.
This could in the long run a give people access to HA through SMS when no data connection is available.

I see their API here. I suspect HA is currently using one of these.

https://www.clicksend.com/us/api-docs/

Thanks! Will look into that.
I asked ClickSend and they support webhook and IFTTT so maybe this could give me an opening to get SMS data to HA… …possibly

In my limited experience with IFTTT, you are lucky to get your output in less than an hour or 2.

1 Like

allright… good to know. That wont work with a car heater :slight_smile:
Webhooks could work maybe.
I am no programmer, so I need to learn more.
Zapier support with HA would be great. That would help us “noobs” haha

Do you have a GSM modem?

I found some tutorials explaining it using it:

  1. Receive SMS on a Raspberry Pi
  2. SMS verschicken und empfangen mit dem Raspberry Pi
  3. Send and Receive SMS Text Messages with Raspberry Pi and SIM800 GSM Board
    all use
    https://wammu.eu/smsd/

There is a tutorial using Python exemplarisch - RPi Tutorial

As SMS are stored as plain text combining them with Folder Watcher could do the job.

I’ve had the same module in my car for a few days now.

From the beginning I wanted to integrate the module into HA.
Sending an SMS is not the problem, I use the HTTP API of AnySMS, it costs per SMS but for the beginning it is OK. Should be possible with any SMS provider that offers an HTTP API.

In the long run it would be nice to be able to receive and send SMS in HA. On the one hand to save money for the SMS provider (SIM card with SMS flatrate) and on the other hand you could receive SMS. SMS receipt is also possible with most providers, but either only on a shared number and keyword (which won’t work with this module) or with too high costs for a fixed number (>30€ per month)

I’ve already tried to get my Huawei LTE stick to run on Linux, which would work in principle, but I run it all on a Synology and Docker and somehow I don’t get the device in the Docker container. Might be a project for the holidays, or I have to go the way of an additional computer (raspberry pi).

In HA the whole thing is called as REST command.

	rest_command:
		car_heater_on:
		  url: !secret rest_car_heater_on_url
		  method: GET

		car_heater_off:
		  url: !secret rest_car_heater_off_url
		  method: GET

		car_heater_info:
		  url: !secret rest_car_heater_info_url
		  method: GET

		car_heater_temperature:
		  url: !secret rest_car_heater_temperature_url
		  method: GET

secrets.yaml

	rest_car_heater_on_url: http://gateway.any-sms.biz/send_sms.php?id=123456&pass=APIPASSWORD&gateway=28&absender=NUMBERFROM&nummer=NUMBERTO&text=ON&test=0
	rest_car_heater_off_url: http://gateway.any-sms.biz/send_sms.php?id=123456&pass=APIPASSWORD&gateway=28&absender=NUMBERFROM&nummer=NUMBERTO&text=OFF&test=0
	rest_car_heater_info_url: http://gateway.any-sms.biz/send_sms.php?id=123456&pass=APIPASSWORD&gateway=28&absender=NUMBERFROM&nummer=NUMBERTO&text=INFO&test=0
	rest_car_heater_temperature_url: http://gateway.any-sms.biz/send_sms.php?id=123456&pass=APIPASSWORD&gateway=28&absender=NUMBERFROM&nummer=NUMBERTO&text=TEMP&test=0

What I can’t do at the moment is to use Alexa/Siri to control the whole thing.

But I think a momentary switch should work, but I didn’t have time to test it yet.

For now I’ve made an iOS shortcut with menu, which calls the service for the REST command in the background via the HA Api. Better than nothing.

Thank you MarH for the info and your setup. I put the whole thing on ice for a while but now I got interest again. Will try and figure it out using Google Home. I use this with the Volvo integration and it’s great.

Thanks! This could be the solutionđź‘Ť

Hi all, I am also looking for a service to receive SMS by HA. The reason is, that I have here and then problems connecting remotely to HA. And it appears that this problem always happens when non-admins of my family want to get into the house but for whatever reason have not been able to switch of HA’s alarm system. I am looking for a solution bypassing LTE/WAN/LAN/WLAN and send a SMS to HA to turn on/off the alarm. If there is any other idea in handling that, feel free to give me a hint. Thx, gl

I’ve been looking at this also. I use Twilio for SMS notification from HA (e.g door open too long, etc.), so I’d like to be able to Ack the alert by responding to the txt.

Twillio allows configuration of a web hook to receive the replies. This would mean exposing an end-point from the HA system on the internet. Something I don’t want to do, given lack of HA being pen tested.

So my current idea would be to set up something in AWS to expose the webhook and use a lambda to place it in an SMS queue. Then in HA use the AWS SMS API to pull messages back. Haven’t priced out the AWS stuff but it should be very cheap since it’s billed based on usage.

Interested in other ideas.

I use pushover (one time charge for my android phone) and notify to sends SMS to my phone

https://pushover.net/login?back_to=/apps/clone/home_assistant

Chas

I just tried using the Android App SMS to URL forwarder .

For the moment that is not conclusive yet. Nothing is received on the webhook - it seems to be an issue with the Android app (I checked the Android logs).

I suppose it can work for others, and it will likely be solve.

It seems that the app will try to forward the SMS several times if the host is unreachable.

This is the webhook I set up (i.e., in an automation).

alias: Receive SMS from SMS to URL forwarder
description: See https://github.com/bogkonstantin/android_income_sms_gateway_webhook
trigger:
  - platform: webhook
    webhook_id: example_name
    alias: When SMS received at https://PUBLIC_HA_DOMAIN/api/webhook/example_name
condition: []
action:
  - service: system_log.write
    data:
      message: "{{ trigger }}"
mode: single

Guess a easy and reliable way would be a sim800l and a esp of choice running esphome

Integrates perfectly via native api into home assistant and the hardware costs only around $10.

No dependencies on clouds (other peoples computers) or a active internet uplink needed to have this working :trophy:

I see that most users have gone the GSM modem route, but the GSM network will be discontinued in the future. Has anyone worked with receiving message from gateways like ClickSend? I would not mind working on the API to receive, I do not know where the current code is stored for the send function and would not know how to begin to implement it in the HA code.
Any ideas?
Thanks

Receiving from an SMS Service can be as simple as setting up an endpoint on your home assistance instance which you could do with a webhook.

Still, this has the disadvantage that if your internet connexion is down, then you do not have access to the service.

I mentioned the Android App SMS to URL forwarder a few posts up. It can in fact also work when there is an absence of the internet.
The Android phone can be connected to the local network and therefore still deliver the payload using WiFi. It might be an easier and also economical method because you do not have to setup the modem in HA, and you can use an old phone you have on the shelve. To send an SMS, the Android App does not propose an interface for that. Maybe another application that could run without the internet exists or the Android App could be extended to propose an interface for that (http socket).

No personal experience, but could this be an option?

Thanks for the reply but I actually kill all internet access to the HA servers except for connecting to the SMS gateway, and then occasionally when I want to do updates. So wouldn’t adding the Android to the mix actually be another entry point into the network? Or does that solution actually give me access to SMS only? GSM is all but gone in our area as 4G and now 5G has replaced it all.
The bottom line is I want to get status updates on demand without exposing the servers to the inet more than necessary.

I do have a hidden MQTT server on the internet and might set up a listener on one of the internal servers that could then trigger script and send the requested information, but there again, now I am opening up another hole. Yes, I am a security freak. I worked in IT and network security for 40 years.

Thanks for any ideas you or anyone else can provide.

Walt