Send SMS with USB GSM modem when alarm triggered

Hi, I need help with usb modem configuration, I have a Huawei E1752 modem connected and it is loaded with sms gateway integration. The integration shows signal strength but the network status is constantly “requesting network”. The simcard is without pin code and is functional however sms cannot be received or sent via homeassistant. The log shows this error:
Logger: homeassistant.components.sms.gateway
Source: components/sms/gateway.py:209
Integration: SMS notifications via GSM-modem (documentation, issues)
First occurred: 23 June 2024 at 13:34:22 (1014 occurrences)
Last logged: 12:07:35
Failed to initialize, error ERR_DEVICENOTEXIST
Would anyone be able to help me with this problem? Thanks

good morning,
I use a 3g key to send sms.
but how do I create several recipients?
i tried to add this in configuration.yaml

mane: sms_x
 - platform: sms
   recipient: +33612345678

but I get an error when checking the configuration
then I tried

notify:
  - platform: sms
    name: sms_x
    recipient: +33612345678

no error when I click on “check configuration”, but after a reboot if I go to
development tools → Services I don’t see notify.sms_x, there’s only notify.sms

I would like to create several recipients:
sms_x
sms-y
how to do

Hi everyone,
How can I fix the error ‘failed: ERR_GETTING_SMSC’? I inserted the SIM card into my phone and tried entering my phone number, but that didn’t resolve the issue. I wish there was a field in the configuration to define the SMSC number.

where exactly do you put this line?
in notify.py file I have

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

may be its line

Line 78         for encoded_message in encoded:
            # Fill in numbers
            encoded_message["SMSC"] = {"Location": 1}
            

Hi,

I’m using the integration with SIM800C modem mentioned on integration site.
I’ve mage conditional automatiotion which checks phone number and content of the message in incoming SMS and it works:

alias: receive_sms_test
description: ""
triggers:
  - trigger: event
    event_type: sms.incoming_sms
    id: sms_read
    event_data: {}
conditions:
  - condition: and
    conditions:
      - condition: template
        value_template: "{{ trigger.event.data.phone == \"+48555555555\" }}"
      - condition: template
        value_template: "{{ trigger.event.data.text == \"TEST\" }}"
actions:
  - type: toggle
    device_id: df3220f3ed39bca665337d67be665693
    entity_id: dd960ec955dca02b8942d7950127d5cf
    domain: switch
mode: single

Maybe somebedy will find it useful.

But I have a question to @Oscar_Calvo:
Can the integration be extended by one more event triggered when someone makes a call to the modem? The call shouldn’t be answered, but the event can return caller phone number as a parameter. Ant then it will be possible to make an automatition which makes something if recognized user makes a call to the modem. Is it possible to instert such extension to code?

Regards,
Mickey

Hi Mickey, I also bought the same Sim800C device (USB a gsm, Modulo seriale da USB a gsm Stabile a frequenze gsm/GPRS SIM800C Modulo seriale da USB a gsm con Funzione Bluetooth per scopi industriali : Amazon.it: Informatica) but I can’t get it to work! Can you tell me what steps you took to identify it in the HW (I have a zimablade). Thanks

Risolto, sono riuscito ad installare il dispositivo e ad attivare l’integrazione.
Ora vediamo se funziona !

@Pava1955: Using Google Translate I found that your modem works with HA? :slight_smile:

I’m using VirtualBox VM with HAOS on FreeBSD. The main problem I had was passing USB device from host to guest. When I’ve done it, then the modem was just discovered in HA as ttyUSB0. But sometimes I have a small problem. When device is disconnected for a while from USB, then it connects back as ttyUSB1 and is not visible in HA. I’m restarting HA OS then and I don’t know if other method exists.

About detecting phone calls:

I’ve read the documentation a bit, but I don’t feel confident enough to modify the HA code. It seems to me that a direct response to “calling the modem” using Gammu may be problematic to implement, if possible at all. But I think it could be done as follows:

  • periodically check for missed calls (GetMemoryStatus(‘MC’)
  • if a new ‘MC’ is detected, generate a notification in HA with the caller’s phone number
  • after generating the notification, clear the ‘MC’ memory (DeleteAllMemory(‘MC’))

I’m not sure whether the ‘MC’ or ‘RC’ memory should be checked.