---
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 don’t 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`.