Send SMS with USB GSM modem when alarm triggered

Can you file a new issue? And add as much detail as you can

Hello collegues )

pereodicaly integration lost the modem(1 time in 2-3 day), only after reinstall intagration some time working with /dev/ttyUSB0, but sometime works only with new settings as /dev/ttyUSB1
Maybe, add universal settings to setup ports(to avoid reinstalling the integration)

Awesome intergration, many thanks! This finally allows me to text friends and family my arrival time, in combination with the (HACS) Tesla intergration. Just awesome.

What I can’t figure out though, is how to send one SMS to multiple numbers - as I get all sorts of errors trying to do this.

service: notify.sms
data:
  message: >-
    I'm on my way, expected arrival time is {{
    (as_timestamp(states('sensor.siegfried_arrival_time')) -
    as_timestamp(utcnow())) | timestamp_custom('%Hh %Mm %Ss',false) }}.
  target: "+316123456789"
enabled: true

What is the proper sytax to add an additional target here; let’s say +44123456789?

1 Like
data:
  message: Hola
  target:
    - "+11234"
    - "+15678"
2 Likes

Quick question, I must overlook something. I successfully can send an SMS by an automation. It is received by my iphone. But I do not get the typical SMS notification sound. In the message on my phone it shows sound is switched off (bell symbol with a strikethrough). Any idea?

Please ignore my question above. Sorry for the trouble. It is not an HA or SMS issue, but a simcard issue. Took me a half a day to come to this conclusion.

Using a Huawei E220 in HA OS on a virtual machine, I get network dropouts at random, and the modem doesn’t reconnect. I think the dropout is a signal strength issue, but no reconnection is the problem.
Restarting the SMS integration doesn’t help, and the integration debug messages just show a connection that is lost. I’ve tried resetting the modem via AT commands from a shellscript but that doesn’t work. I looked at resetting the USB device, but that’s not possible in HA OS.
The only solution I’ve found is to restart HA via the “Home Assistant Core Integration: Restart” service. At the moment I have an automation that restarts HA every time the network drops.
As the underlying OS doesn’t restart, it can’t be an issue with the USB subsystem, and I’m guessing it’s restarting Gammu that gets it to reconnect.
Does anyone have any faultfinding steps they can suggest?
Is there a smaller part of the HA system that can be restarted to regain connection?

@Oscar_Calvo I receive SMS from the garbage collectors a couple of times a week, unfurtunately their messages are longer than 160 characters, which means it has to be split up.

It seems to be a issue to do that. i can easily send out messages longer than 160 characters from home assistant but i will not receive them if they are longer than 160.

Is there a way to intercept them and shorten them or ignore the splitted part ( i am mostly interested in the first 2 lines of the text, which has dates and what is being collected)

I have similar problem with my Huawei E3272 modem in HAOS.
Modem connection runs in an indefinite cycle:

  1. Connection works for exactly 40 seconds then disconnects
  2. Next connection starts in cca 11 minutes + 10-20 seconds
    Here you can see the devices:
    image
    and the connection cycle:

    Following messages appear in the DEBUG log:
2023-03-05 15:02:38.325 INFO (MainThread) [homeassistant.components.sms] Fetching Device network state data recovered
2023-03-05 15:02:38.365 INFO (MainThread) [homeassistant.components.sms] Fetching Device signal state data recovered
2023-03-05 15:03:18.235 ERROR (MainThread) [homeassistant.components.sms] Timeout fetching Device network state data
2023-03-05 15:03:18.361 ERROR (MainThread) [homeassistant.components.sms] Timeout fetching Device signal state data

Not sure how to fix the problem for a long time, it’s not new.

In my case it was a signal/noise ratio problem. A better antenna fixed the issue for me.

Thanks for suggestion, I was also expecting weak signal could be the issue reason so I was waiting with reporting after buying an antenna. But after connecting 2 small antennas and re-test the situation is exactly the same.
I will move the modem to another location and monitor the signal to be sure it’s not the problem reason.

Tested the signal in Windows PC via Huawei Mobile Partner, it’s OK
Connection works for minutes there until I disconnect.
I have re-configured setport via terminal to mode “4G MODEM” + “4G PCUI” before plugging back to HassOS:

AT^SETPORT=?
^SETPORT:1: 3G MODEM
^SETPORT:2: 3G PCUI
^SETPORT:7C: SerialC
^SETPORT:78: Shell A
^SETPORT:79: Shell B
^SETPORT:76: NCM
^SETPORT:A1: CDROM
^SETPORT:A2: SD
^SETPORT:61: 4G MODEM
^SETPORT:62: 4G PCUI
^SETPORT:7B: SerialB
^SETPORT:7A: Serial

AT^SETPORT="FF;61,62"
AT^RESET

Seems I have finally found the solution. Re-created the integration in HA again with the second usb device /dev/serial/by-id/usb-Technology_Mobile_FFFFFFFFFFFFFFFF-if01-port0 and port speed set to Auto.
It finally WORKS without dropping the connections. :slight_smile:

Great, thanks! I didn’t think of setting setport on another computer.
Hopefully that works, if not I’ll have to spend another 50sek on a E3272!

Hi
I bought SIM800C Module Like this:
https://www.amazon.com/gp/product/B087Z6F953/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1

I installed HAOS on Lattepanda embedded Board (Generic 86-64) with these informations:

information

after connecting the module to USB port when I want to add integration Device " SMS Notification Via GSM Modem" , This error occurs:

Error

In the event that before connecting the module, a window opened that it want the device name.

when in terminal enter these commands:

when I add this code to Configuration.yml:
Configuration

when I want To restart the HA this error display:
HA Restart

Please Help me.
Thanks

Good day.
I found your script here, and it works perfectly… from the command line.

How would i make an integration for when someone disarms alarmo to say

send to 555-555-1212
msg “Owen disarmed the system”

would you know where to point me in the right direction?

Good day

I have a trouble with SMS notification via GSM-Modem, its failed whit timeout error. I use SIM800C usb version, on x86 home assistant, in attchet screenshot USB0 is Sim800c, USB1 is zigbee cordinator,

Thanks for support in advance


This seems to have worked, but only after I deleted and re-created the integration. There was also a firmware update for the dongle that I applied.

Are you sure that ttyUSB1 is the zigbee co-ordinator? Both ttyUSB0 and ttyUSB1 look like they’re associated with the same device. In most cases the second USB serial instance is the correct one.
Another possibility is that your device doesn’t respond properly some of the AT commands (AT+IPR=? maybe), so you will have to manually set the baud rate.
Otherwise try a reset using a serial terminal. You’ll have to find the AT command list for your device to see what ‘factory reset’ is.

In the end I changed to a Huawei E173 - works flawlessly. I could get the E220 to stay connected better but it was still a bit flaky. The E173 and E220 are about the same second hand these days, so it’s the better option.

1 Like

Hello, does anyone knows if its possible to do this with a huawei routeur like this one ?
It has a USB plug ?