Send SMS with USB GSM modem when alarm triggered

Already tried twice, no help. Now the integration had been deleted and system rebooted.

I’m been struggling for an hour with the change to a generic notify.sms service with targets, specifically with retaining the “+” prefix to the targets.

In secrets.yaml I have:
sms_target1: '+44nnnnnnnnnn'

In templates.yaml I have:

    - name: sms_target1
      unique_id: sms_target1
      state: !secret sms_target1

The number display corrrectly in Developer Tools

In automations I am using:

    - service: notify.sms
      data:
        message: "Test."
        target: "{{ states('sensor.sms_target1') }}"

The message fails with an error indicating a dropped ‘+’ sign.

Testing manually in Developer Tools with the number quoted works. With the template it fails (dropping the ‘+’)

Any tips on how I can ensure the target includes the ‘+’ would be greatly appreciated.

Replace + for 00

1 Like

Thanks that 's resolved it once I reworked some automations accordingly (as I vet received SMS by the sending number).

However I’m not able to use the new unicode parameter successfully either from automations (in YAML) or through the Developer Tools section.

using as a base:

service: notify.sms
data:
  message: "status request"
  target: "0044nnnnnnnn"
  data:
    unicode: False

I’ve also tried unicode: false and unicode: "False"

In each case the alarm panel does not respond, but it responds to my phone (Pixel 6 Pro with Google Messages) and if I reinstate my workaround, replacing is_unicode in notify.py with False, e.g.:

        smsinfo = {                                                         
            "Class": -1,                                                    
            "Unicode": False,                                          
            "Entries": [{"ID": "ConcatenatedTextLong", "Buffer": message}], 
        }

the communication with the alarm panel is successful after restarting homeassistant.

I assume this means the unicode parameter I’m sending is incorrect in some way but just can’t see what I’m doing wrong.

service: notify.sms
data:
  message: "status request"
  target: "0044nnnnnnnn"
  unicode: False

Can you try this?

Apologies for the delay - only just seen this.
The unicode parameter is rejected with an error in that position.

Error while executing automation automation.sms_alarm_comms_check: extra keys not allowed @ data['unicode']

I think there is a bug in the sms integration. I will try to debug it next weekend.
Can you file a new issue to track this problem?

2 Likes

Thank you for your time on this - raised as 78719.

It’s HUAWEI 3131. After OS update to 9.0:

  • when I start up the device it is not provided the IP (it loads HA and the sms notifications work but HA is not reachable over network, HA address is not pingable)

  • when I unplug the stick and boot everything works well, then I plug the stick back and I can see the device as:
    modem_config

  • The integration seems to see the modem (network and signal strength) and there are no errors thrown when I test the service however the messages do not come out

  • An attempt to reboot the device with plugged in stick gets me back to point 1 (not able to reach HA over network).

Fix is out:

3 Likes

Can you connect an HDMI monitor to the device and capture the boot log?

1 Like

Gsm alphabet fix is in. It should be deployed in 2022.10.0

2 Likes

Hi, i’ve just bought a SIM800C HAT for my home assistant os installation. I’ve connected it to gpio ports and it power up. Unfortunately there’s no way that the device is recognized by home assistant, even under /dev/ no new device is present. Can someone help?

If this is the Hat, you need to change a boot config parameter to expose the Hat as /dev/ttyS0

But I forgot the name of the parameter

Update:

  • messages not coming out was caused by the other bug (country code with plus not recognized, fixed that with “00” workaround
  • not able to boot up with usb stick on persists - will capture the logs and attach by the weekend

Well the problem was more easy. Home assistant os stopped to support GPIO.
Right now i’ve bought a SIM800c usb key and i’ve another problem. HA os hang when i insert the key.

This is not true, I am using the same sim800 hat with the latest Hass OS and it still works.

Hi,

I read all posts in this thread, but I still can’t configure SIM800C device. When I tried to configure it, I see an error in logs:

2022-10-03 00:21:15.034 ERROR (MainThread) [homeassistant.components.sms.gateway] Failed to initialize, error ERR_TIMEOUT

When I tried to put this code (post 337) to configuration.yaml, I see an error:

sms:
  device: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
  notify:
   - platform: sms
     name: sms_person1
     recipient: "+421my_phone_number"

Invalid config for [sms]: [notify] is an invalid option for [sms]. Check: sms->sms->notify. (See /config/configuration.yaml, line 22).

How it is possible to configure this device with HA OS?

Home Assistant 2022.9.7
Supervisor 2022.09.1
Operating System 9.0
Frontend 20220907.2 - latest

Hardware
Raspberry Pi 4
SIM800C - USB version
SIM card - inserted

Connection to the modem via integration:
Device: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
Baud Speed: Auto

Thanks.

Please remove the manual configuration and instead add the SMS integration via the UI.
Use /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0 as the device when prompt in the dialog box.

Are you using the HAT version of the SIM800 or the USB version?
For the HAT version your device should be /dev/ttyS0