renat85 b9935a9fa7
Add tested model modem and solution for RPI (#14265)
Add tested model modem and solution for work on Raspberry PI without udev rule.
2020-08-20 05:11:56 +02:00

4.2 KiB

title, description, icon, ha_category, ha_release, ha_iot_class, ha_config_flow, ha_codeowners, ha_domain
title description icon ha_category ha_release ha_iot_class ha_config_flow ha_codeowners ha_domain
SMS notifications via GSM-modem SMS notification via GSM modem. gammu.png
Notifications
0.105 Local Polling true
@ocalvo
sms

The sms integration allows having a local execution SMS notification via Gammu. This is ideal when the internet is offline or when the power goes out.

This integration provides the following platforms:

  • Notify

Configuration

Activate SMS via the integrations menu and search for SMS. While activating the integration, it will ask for your serial device. Make sure the device is connected and have a valid SIM activated.

You can also enable SMS via your configuration.yaml file:

# Example configuration.yaml entry
sms:
  device: /dev/ttyUSB2

To configure the notification service, edit your configuration.yaml file:

notify:
  - platform: sms
    name: sms_person1
    recipient: PHONE_NUMBER
  - platform: sms
    name: sms_person2
    recipient: PHONE_NUMBER

{% configuration %} device: description: The gsm modem device. required: true type: string {% endconfiguration %}

To use notifications, please see the getting started with automation page.

If the integration is used with the Home Assistant Operating System, then version 3.6 or higher is required.

For installations not running on Home Assistant or Home Assistant Core using Docker, you must install gammu-dev package:

sudo apt-get install libgammu-dev

Before running for the first time, check that the system recognizes the modem by running:

ls -l /dev/*USB*

Note: When running Home Assistant, you need to install the SSH add-on.

Required Hardware

You will need a USB GSM stick modem.

List of modems known to work

List of modems that may work

Huawei modems on Raspberry Pi (and similar) devices

For some unknown reason, the rule that converts these modems from storage devices into serial devices does not run automatically. To work around this problem, follow the procedure to create udev rule on a configuration USB stick for the device to switch to serial mode.

  1. Try disable virtual cd-rom and change work mode "only modem". After this modem correct work on Raspberry Pi without 'udev' rule.

  2. Run lsusb, its output looks like this:

bus 000 device 001: ID 1FFF:342a
bus 001 device 005: ID 12d1:15ca   <-------- Huawei is usually 12d1
bus 000 device 002: ID 2354:5352
bus 000 device 002: ID 1232:15ca

Identify the brand for your GSM modem, copy the brand_Id and product_id (In this case brand_id = 12d1 and product_Id = 15ca)

Set this content in file udev\10-gsm-modem.rules in the configuration USB: (Replace brand_Id and product_id for the numbers reported by lsusb)

ACTION=="add" \
, ATTRS{idVendor}=="brand_Id" \
, ATTRS{idProduct}=="product_Id" \
, RUN+="/sbin/usb_modeswitch -X -v brand_Id -p product_Id"

Here is a sample configuration file:

ACTION=="add" \
, ATTRS{idVendor}=="12d1" \
, ATTRS{idProduct}=="15ca" \
, RUN+="/sbin/usb_modeswitch -X -v 12d1 -p 15ca"

Plug the USB stick, reboot the device, run lsusb again. The resulting product id now should be different and the brand id should be the same. And ls -l /dev/*USB* should now report your device.

If the device is still not recognized, remove the parameter -X from the usb_modeswitch command and reboot again.

More details: