yehor e02ced287b
All checks were successful
Build release image / build (push) Successful in 1m30s
Migrate more blog posts
2025-05-20 13:24:39 +03:00

45 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
slug: send-and-receive-sms-in-home-assistant-with-gsm-modem
title: "Send and receive SMS in Home Assistant with GSM modem"
tags: [smart home, Home Assistant, home automation, SMS, GSM]
image: /img/blog/2021/01/modem.jpg
---
Yes, it is possible and you dont need to build anything from sources. Sending SMS from your home could be useful, for example, to send emergency alerts. But what about receiving and parsing SMS messages? Well, I used it to integrate my car security system with my Home Assistant. Now my Home Assistant could start the engine of my car automatically to warm it up before driving to work.
<!-- truncate -->
First of all, we need to set up notification service via GSM modem following the official [documentation](https://www.home-assistant.io/integrations/sms). This will allow us to send SMS messages by calling the notify service, for example in automation action:
```yaml
action:
- service: notify.sms
data:
message: Hi!
```
But also this integration allows reading SMS messages sent to the modem phone number by listening to the `sms.incoming_sms` event.
```yaml
trigger:
- platform: event
event_type: sms.incoming_sms
```
![Automation trigger in UI](income_trigger.png)
In automation `action`, we can now parse the message by searching keywords in it:
```yaml
action:
- choose:
- conditions:
- condition: template
value_template: >-
{{'engine is off' in trigger.event.data['text']}}
sequence:
- ...
```
![Parsing action](parse_action.png)
Here we are checking for the `engine is off` text in incoming SMS to perform some action. For example, to set the value of some `input_boolean`.