core: Event `sms.incoming_sms` not fired (but SMS visible in gammu CLI)

The problem

I’m using sms integration with a Huawei E1752 3G USB modem. I do can send SMS using notify.sms_xxx service (sms_xxx being the name in notify section with platform: sms). Tho when listening to sms.incoming_sms in the developer tools of HA, nothing happens when I send text messages to the phone number of the modem’s SIM card. But if I use the gammu CLI on the machine running HA, using same device, I can see my SMS there using gammu getallsms

Environment

  • Home Assistant Core release with the issue: 0.118.0
  • Last working Home Assistant Core release (if known): NA
  • Operating environment (OS/Container/Supervised/Core): About within HA interface:
    System Health
    
    Home Assistant Core Integration
    
    version: 0.118.0
    installation_type: Home Assistant Container
    dev: false
    hassio: false
    docker: true
    virtualenv: false
    python_version: 3.8.6
    os_name: Linux
    os_version: 5.4.0-54-generic
    arch: x86_64
    timezone: Europe/Paris
    
    Home Assistant Cloud
    
    logged_in: false
    can_reach_cert_server: ok
    can_reach_cloud_auth: ok
    can_reach_cloud: ok
    
    Lovelace
    
    dashboards: 5
    mode: storage
    views: 2
    resources: 14
    
    Host machine:
    huafu@octopus:~/infra/docker/core$ cat /etc/os-release 
    NAME="Ubuntu"
    VERSION="20.04.1 LTS (Focal Fossa)"
    ID=ubuntu
    ID_LIKE=debian
    PRETTY_NAME="Ubuntu 20.04.1 LTS"
    VERSION_ID="20.04"
    HOME_URL="https://www.ubuntu.com/"
    SUPPORT_URL="https://help.ubuntu.com/"
    BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
    PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
    VERSION_CODENAME=focal
    UBUNTU_CODENAME=focal
    
    huafu@octopus:~/infra/docker/core$ uname -a
    Linux octopus 5.4.0-54-generic #60-Ubuntu SMP Fri Nov 6 10:37:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
    
  • Integration causing this issue: sms
  • Link to integration documentation on our website: https://www.home-assistant.io/integrations/sms

Problem-relevant configuration.yaml


sms:
  device: /dev/ttyUSB1 # I have tried ttyUSB0, 1 and 2 with same result

# sending to each of those worked perfectly, but no `sms.incoming_sms` event for messages
# sent from one of those 4 (tho SMS are visible in gammu CLI)
notify:
  - platform: sms
    name: sms_huafu
    recipient: xxxxxxxxxx
  - platform: sms
    name: sms_bam
    recipient: xxxxxxxxxx
  - platform: sms
    name: sms_atid
    recipient: xxxxxxxxxx
  - platform: sms
    name: sms_ellie
    recipient: xxxxxxxxxx

Traceback/Error logs

nothing in the logs :-/

Additional information

docker-compose service

# docker-compose.yml
version: "3.6"
services:
  #[...]
  hass:
    image: abeh/home-assistant
    build: ./hass/docker
    container_name: hass
    restart: unless-stopped
    mac_address: xx:xx:xx:xx:xx:xx
    networks:
      mv-domotik: # this is a macvlan bridge
        ipv4_address: 192.168.16.2
      web:        # create with docker network create web
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./hass/config:/config
    devices:
      - /dev/ttyUSB0 # I'd need only one but while testing each I prefer to map all
      - /dev/ttyUSB1
      - /dev/ttyUSB2

Dockerfile, just to add gammu related packages

# hass/docker/Dockerfile
FROM homeassistant/home-assistant:stable
RUN apk add --no-cache gammu gammu-dev gammu-libs

Gammu CLI test

huafu@octopus:~/infra/docker/core$ docker-compose exec hass cat /root/.gammurc
[gammu]
port = /dev/ttyUSB1
model = 
connection = at19200
synchronizetime = yes
logfile = 
logformat = nothing
use_locking = 
gammuloc = 

huafu@octopus:~/infra/docker/core$ docker-compose exec hass gammu getallsms
Location 1, folder "Inbox", SIM memory, Inbox folder
SMS message
SMSC number          : "+33695xxxxxx"
Sent                 : Sat Nov 21 08:37:26 2020 +0100
Coding               : Default GSM alphabet (no compression)
Remote number        : "+33769xxxxxx"
Status               : Read

Hello HA!

Location 2, folder "Inbox", SIM memory, Inbox folder
SMS message
SMSC number          : "+33695xxxxxx"
Sent                 : Sat Nov 21 08:42:59 2020 +0100
Coding               : Default GSM alphabet (no compression)
Remote number        : "+33769xxxxxx"
Status               : Read

Test

Location 3, folder "Inbox", SIM memory, Inbox folder
SMS message
SMSC number          : "+33695xxxxxx"
Sent                 : Sat Nov 21 09:44:00 2020 +0100
Coding               : Default GSM alphabet (no compression)
Remote number        : "+33769xxxxxx"
Status               : UnRead

Test 2

relevant output for lsusb -v

Bus 002 Device 002: ID 12d1:1001 Huawei Technologies Co., Ltd. E161/E169/E620/E800 HSDPA Modem
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x12d1 Huawei Technologies Co., Ltd.
  idProduct          0x1001 E161/E169/E620/E800 HSDPA Modem
  bcdDevice            0.00
  iManufacturer           3 HUAWEI Technology
  iProduct                2 HUAWEI Mobile
  iSerial                 4 1234567890ABCDEF
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0055
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          1 Huawei   Configuration
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0001
  Self Powered

dmesg in case it can help:

huafu@octopus:~/infra/docker/core$ dmesg | grep -i -P 'gsm|ttyusb|huawei|modem'
[    1.198855] usb 2-2: Product: HUAWEI Mobile
[    1.198857] usb 2-2: Manufacturer: HUAWEI Technology
[    4.346119] usbserial: USB Serial support registered for GSM modem (1-port)
[    4.346218] option 2-2:1.0: GSM modem (1-port) converter detected
[    4.346352] usb 2-2: GSM modem (1-port) converter now attached to ttyUSB0
[    4.346415] option 2-2:1.1: GSM modem (1-port) converter detected
[    4.346535] usb 2-2: GSM modem (1-port) converter now attached to ttyUSB1
[    4.346598] option 2-2:1.2: GSM modem (1-port) converter detected
[    4.346732] usb 2-2: GSM modem (1-port) converter now attached to ttyUSB2

Is there a way I can verbose the logs for only one integration? Maybe it could help… but yeah, no related output in the logs now

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 26 (9 by maintainers)

Most upvoted comments

@ocalvo Since every dongle works a bit different and the gammu command line tool doesn’t appear to allow you to send arbitrary AT commands to the dongle might I suggest a debug mode for this integration? In this mode gammu service would be stopped and you would interact directly with the dongle via UI backed by pyserial. In addition to the ability to type out a command by hand add add some canned commands you can run with a click or two like:

AT+CNUM - Get assigned phone number AT+CREG - Get network registration status AT+CGSN- Get dongle serial number (IMEI) AT+CCID - Get SIM card serial number (ICCID) AT+COPS - Get list of available networks/select network AT+CNMI - Set SMS Notification Preference AT+CMGS - Send Outbound SMS

I can write a guide to add to the integration page on the homeassistant website to show how to use this to diagnose and fix problems

With command AT+CNMI=1,1,0,0,0, it seems to work ! I disconnect from my PC to reconnect in HASS and I come back to tell you if it work for me.

@cllatser - SIM800 is cheap for a reason - it only supports 2G networks which are quickly being phased out across the world. Spend a few extra bucks and get something in their 7000 series that does LTE.

Awesome ! It’s work for me in HASS now. Thanks @jraynes

For what its worth sms.incoming_sms is working fine for me using a SIM7600A-H 4G module I got off Aliexpress + a T-Mobile MNVO SIM Card. I think the HA integration/gammu library is just watching the serial port for an indicator from the dongle that a message was received.

@huafu @PaulAnnekov - Try plugging your dongle into a laptop or desktop and opening the serial port using PuTTY, minicom etc and send a text to it. You should see something like +CMTI: "SM",1 come up. If not you probably need to enable SMS notifications with the AT+CNMI command

Hello, I still have the problem with latest version of home assistant core (official docker version) (2020.12.1)