Send sms with huawei usb e352 o vodafone K5161Z

Hi, I wanted to know how to send text messages from Home Assistant with one of these two USB sticks. The e352 is recognized as ttyUSB1 and ttyUSB0. Thank you for your help.

Do the extended Hayes AT command set functions work?
You send them to the virtual serial port.

Is there a topic or guide I can follow? Both are recognized, except that the Vodafone one is only recognized as a modem. The e352 one, however, seems to detect the SMS sending part.

What chipsets do they have inside? The data sheets for those chips are usually most helpful. You may have to translate from Chinese however. If you are stumped, look at a frequent hobbyist one commonly deployed, the SIM800L often discussed in the Arduino forums. Any simple serial terminal program will work with them, as long as you have your serial port configured correctly. Serial communication programs and libraries in Python are already present in the HomeAssistant environment, and are well documented.

Yes, that is what the patented Hayes AT modem control set escape sequence was originally developed for, Hayes being a leading vendor of modems in the dialup era when the Internetz was in its infancy, and each vendor has extended it for their needs for text messaging in the GSM era. Yes there are standards, but they vary. The one that immediately comes to mind is ATH0 which means ‘hang up’, and ADTD followed by the number to dial up, some of which my fading memory can still whistle into a phone to call up still working BBS lines, my difficulty is the password, not the user name at 75bps!

Ask the vendor direct if a web search is not productive. You may have to sign a NDA to get the information however.

Look at fax machines also - they use an extended AT command set for their functionality also, and the standards are well defined in the industry.

Certain modem/router vendors publish their command sets also - I remember vaguely seeing something for a multifunction FritzBox recently that may be of use for ideas and experimentation. It supported ADSL, WiFi, Fax, VOIP, and DECT telephony as well as normal router functionality, all in one box full of specialist chips, each dedicated to their specific role, carefully choreographed through one GUI to tie it all together.

Your biggest challenge will be the search terms to use. GSM, SMS, HAYES AT, TEXT MESSAGE FORMAT, PYTHON, GITHUB, HOMEASSISTANT are ones that pop into mind.

RCS is another level, adding rich text format to usual SMS messaging. Closely guarded by Apple, and recently reverse engineered by a teenager for Android users, the story is also fascinating reading.

A word of caution: Spammers sending unwelcome/unsolicited text messages have a special place in hell. Please do not develop tools that make it easy for them. May the fleas of a thousand camels infest their armpits and crotches is my sincerely deep and special wish for them. Please add rate limiting to your code, not just to discourage the spammers, but to stop your inbound text messages from overflowing on your phone in case your code goes rogue.

echo -e “AT+CMGF=1\rAT+CMGS="+39NUMERODESTINATARIO"\rCiao da Home Assistant\x1A” > /dev/ttyUSB1

After several attempts, I managed to send a text message from my Huawei E352 dongle using this command. Now I’m wondering how I can get a text message to be sent in the event of an alarm. Thanks for your help.

ho risolto il problema. grazie a tutti

All those AT+ escape sequences.

Add some content to your text message. Build on what you have discovered.
Linux piping to bare metal ports is one option. Doing it via robust pre-built Python libraries is another.
Triggering the send command when an alarm is raised is probably going to be just an extension of any existing notification method you already have configured.
Good luck with your end solution.