Is there a way to restart modem without restarting whole system?
SSH command or something?
I prepeare flashing stuff in one place for Huawei E3372h-153 USB modem stick.
To download it:
www.vseznalec.si
Username:
homeassistant
Password:
virtualclone2020_weeWX%
File:
E3372h-153.zip
I will also publish clone of Raspbian OS (image) with already prepeared flashing guide under the OS… This is needed in first step, second step is flash again under Windows OS, after that the last step is to set AT codes…
Would it be possible to add support for Flash SMS and maybe MMS (send a picture of my ipcam). Gammu supports Flash SMS which results in a sticky message (full screen) on the receiving end, great for fire or alarms etc.
I’m using a SIM800Lv2 and a FTDI to connect to a NUC. No idea if SIM800Lv2 supports MMS.
Thanks for this integration!
I configured it in my HA and SM sending works like a charm.
Unfortunately, it seems that receiving doesn’t work at all. When I send a message to HA/modem then no event is triggered. How can I check what is going on?
My modem is E3272. Home assistant is on RPI4.
While I don’t oppose MMS, the value of the SMS integration is to NOT depend on the internet for communication and MMS does require an active internet connection.
If you require to send pictures from a camera I recommend to use a messaging system that uses the internet.
If MMS is depended on internet I agree that its of no use. I use Pushover which support “sticky” notifications which keep popping up until read. For SMS flash or Class 0 is very “sticky”. From gammu docs:
TEXT
[-inputunicode] [-16bit] [-flash] [-len len] [-autolen len] [-unicode] [-enablevoice] [-disablevoice] [-enablefax] [-disablefax] [-enableemail] [-disableemail] [-voidsms] [-replacemessages ID] [-replacefile file] [-text msgtext] [-textutf8 msgtext]
¶
Take text from stdin (or commandline if -text specified) and save as text SMS into SIM/phone memory.
-flash
``
Class 0 SMS (should be displayed after receiving on recipients’ phone display after receiving without entering Inbox)
Also worth noting from a UK perspective that most mobile providers charge ~£0.55 per MMS and they are not included in any monthly contracts.
If an automation went wrong it could get quite pricey very quickly.
I can confirm the Huawei UMG1691 works with this integration, here is how I did it for anyone trying with that modem.
Homeassistant hardware: Wyse thin client (running NUC build), software version: 0.116.4
USB modem: Huawei UMG1691, T-mobile branded. $9 on eBay
Initially with lsusb
I was getting the UMG1691 showing as Bus 002 Device 002: ID 12d1:1446
and no new devices showed up in the serial:
hardware list in Supervisor > Host System > Hardware.
To fix this, I did the following:
- Insert the UMG1691 into a PC, it shows up as a storage device. Install T-mobile mobile data connection manager software included on that storage device. Two new COM ports will be created, for me it was COM5 and COM6
- Use putty or equivalent to connect to one of the new COM ports (COM5 worked for me) and send AT [enter] to see if you get an OK response. If no response, try the other COM port.
- Send AT^U2DIAG=0 to force the modem into serial modem mode every time it’s plugged in
Now I took the UMG1691 out of the PC and put it in my Homeassistant box. lsusb
now returns Bus 002 Device 002: ID 12d1:1001
and the hardware list is now showing 3 new devices:
/dev/ttyUSB0
/dev/serial/by-id/usb-HUAWEI_Technology_HUAWEI_Mobile-if00-port0
/dev/ttyUSB1
/dev/serial/by-id/usb-HUAWEI_Technology_HUAWEI_Mobile-if01-port0
/dev/ttyUSB2
/dev/serial/by-id/usb-HUAWEI_Technology_HUAWEI_Mobile-if02-port0
I tried adding the SMS integration straight away but it kept giving me Failed to Connect messages no matter what I entered in the Device field. I decided to restart my home assistant server and then I was able to enter /dev/serial/by-id/usb-HUAWEI_Technology_HUAWEI_Mobile-if02-port0 as the device and the integration added successfully.
Set up the notify service as the instructions show, and I’m able to send SMS notifications and see incoming messages using the “Listen to events” tool in Developer Tools.
Also, for people wondering how to use sms.incoming_sms
in automations:
- alias: Read SMS
initial_state: 'on'
trigger:
platform: event
event_type: sms.incoming_sms
action:
service: notify.notify
data:
title: "SMS received"
message: >
SMS from: {{trigger.event.data.phone}};
Text: {{trigger.event.data.text}}
I love the idea of this, but I’m not sure I grasp the concept… Wouldn’t you need some sort of SIM card so you had a number to send from? What role is the GSM modem playing in this setup? How do you define what number is actually sending the SMS and what costs are associated with each message sent?
Yes the GSM Modem requires a SIM card - the modem provides telephony functions with the SIM present. The network operator providing the SIM and the tariff provide the number and associated costs.
In the UK I use mine with a GiffGaff SIM with a rolling top up on PAYG - each SMS costs 10p to send so I use SMS notifications as a fallback for when the house internet connection fails or we are overseas without data. In these modes HA triages notifications and sends critical notifications only to keep costs under control.
Cool! Thanks for the info! Definitely going to need to look more into this.
Thanks @kap that saved me a lot of time and a headache.
To save time for others:
I used an unlocked Huawei E3531 and not all commands is supported by Huawei modems.
I found this: https://routerunlock.com/useful-at-commands-for-huawei-modem/
And to set an E3531 in modem-only-mode I had to send this command:
AT^SETPORT=“A1,A2;1,2,3”
Then I could add it to my HA machine witout any problems.
I got a working setup for sending and receiving, but…
When I use an automation like:
- alias: Read SMS
initial_state: 'on'
mode: queued
trigger:
platform: event
event_type: sms.incoming_sms
action:
service: notify.notify
data:
title: "SMS received"
message: >
SMS from: {{trigger.event.data.phone}};
Text: {{trigger.event.data.text}}
And a new text message is received, i got the last 20 messages. Even old ones…
Is it possible to delete them after event is triggered??
Hi
Is it possible to set up alarm for calls?
Hi,
Thanks for this great work !!
I wanted to try to make the incoming SMS event work on a Huawei E1752
Sending SMS is OK
I’m working on Hass.io on a raspberry pi 3b+
I’ve tried with :
/dev/ttyUSB0
/dev/ttyUSB1
/dev/ttyUSB2
Each time, sending sms was fine but no activity on receive when listening the sms.incominig_sms event
Did somenone have any idea please ? (sorry for my poor English)
Regards,
lacrima08
I purchased a Huawei E3531 not realising that is has problems receiving texts when using Gammu. I have it now working on a raspberry pi and had created the following that runs as a daemon:
#!/usr/bin/python
import shutil
import requests, sys
import xml.etree.ElementTree as ET
import paho.mqtt.client as paho
import os
import time
broker = "192.168.7.1" #MQTT broker IP address
port = 1883 #MQTT broker port
topic = "alarm/sms-incoming" #MQTT topic
ip = "192.168.1.1" #Dongle IP address
newloc = "/home/pi/alarmsms/temp" #Location to store new.txt for comparison
oldloc = "/home/pi/alarmsms/temp" #Location to store old.txt for comparison
client1=paho.Client("control1") #create MQTT client object
# os.system("sudo usb_modeswitch -v 12d1 -p 1f01 -M '55534243123456780000000000000a11062000000000000100000000000000'")
while True:
#Get token
r = requests.get("http://"+ip+"/api/webserver/token")
root = ET.fromstring(r.content)
token = root[0].text
print "token", token
if not os.path.exists(newloc+"/new.txt"):
file(newloc+"/new.txt", 'w').close()
shutil.move(newloc+"/new.txt", oldloc+"/old.txt")
#Check SMS received
headers = { "__RequestVerificationToken": token, "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "X-Requested-With": "XMLHttpRequest", "Referer": "/html/smsinbox.html?smsinbox" }
data = "<request><PageIndex>1</PageIndex><ReadCount>1</ReadCount><BoxType>1</BoxType><SortType>0</SortType><Ascending>0</Ascending><UnreadPreferred>1</UnreadPreferred></request>"
r = requests.post( "http://"+ip+"/api/sms/sms-list", data=data, headers=headers )
print "send-sms", r.headers, r.content
text_file = open(newloc+"/new.txt", "w")
text_file.write(r.content)
text_file.close()
#compare
with open(newloc+"/new.txt") as newfile:
with open(oldloc+"/old.txt") as oldfile:
if newfile.read() == oldfile.read():
time.sleep(2)
else:
client1.connect(broker,port) #establish connection
ret= client1.publish(topic,r.content)
time.sleep(2)
I am not a coder so this was bodged together, but it does work.
Basically, when a new SMS is received, if it’s different from the last SMS received then the data will be sent to the specified MQTT topic. I then use nodered to manipulate the data and send on to my alarm system to arm etc
One thing I had to do, was make sure the Huawei E3531 was set to the right mode. It should be the following for the above to work:
ID 12d1:14dc Huawei Technologies Co., Ltd. E33372 LTE/UMTS/GSM HiLink Modem/Networkcard
To do this, I had to run the following:
sudo usb_modeswitch -v 12d1 -p 1f01 -M ‘55534243123456780000000000000a11062000000000000100000000000000’
I’m a noob. I’m trying to install the SMS integration but I don’t know my device’s location. Here is what I know:
Rpi4/64/8gb / SSD boot / HassOS 5.1. / Home Assistant 0.117.6
I am trying to install this ZTE MF833V modem.
The Amazon reviews include buyers who have successfully used the device on their Pi. I have it plugged into a USB hub that connects to a USB3 port on my Pi. Earlier, I installed/tested the modem on my Windows laptop and when the network connection had been established, a blue led was constantly flashing on the modem. This same blue led is flashing while the modem is currently plugged into my Pi, so I suspect that a proper connection has been established with my Pi. Here is what my Pi displays on the screen when I plug in the modem:
And
notice the final IPv6 line. usb0: link becomes ready
So, I have reason to believe this modem should work. I have run the lsusb command and added a USB drive with volume label CONFIG and /udev/10-gsm-modem.rules with the appropriate IDs from my lsusb results (19d2:1405).
> ACTION=="add" \
, ATTRS{idVendor}=="19d2" \
, ATTRS{idProduct}=="1405" \
, RUN+="/sbin/usb_modeswitch -v 19d2 -p 1405"
I have run
ls -l /dev/
*
USB*
This gives me “no such file or directory”.
I have tried adding the device location /dev/ttyAMA0, /dev/ttyUSB0, /dev/ttyUSB1, /dev/ttyUSB2 and all have failed.
It is not clear to me how I might add this modem to Home Assistant. Perhaps someone would be willing to assist.
Hi,
In my case, also with a E3531 the AT command that did the trick was : AT^SETPORT=“FF;10,12” as seen on the following website : https://blog.le-vert.net/?p=196
Can’t believe how hard it was to set this up… Had to install Hilink, install COM support in Windows 10 as it is considered legacy, launch a special curl command to go in COM mode, find a correct unlock code, change firmware, find and install drivers in Windows, set-up Putty correctly yo be able to launch AT commands, test various AT commands… But it seems I was successful at last :-p
There is a known issue in gammu where the API that deletes old messages fails.
This has already been fixed, and we need to update of the hass os to get the fix.
I just picked up an E3372h-510 and followed a hybrid of the steps provided in this link and this link to switch it to “stick mode”.
This method works! I am sending SMS with no need for a modeswitch file. It requires that you open your modem with a Torx screwdriver and ground out the connection (as shown in the below video), then proceed with the commands to flash the proper firmware (as described in the links I provided above).
@Oscar_Calvo linked to this page in an earlier post, but I think that method no longer works. @kslb perhaps you are still interested. I’m entirely new to Linux and I was able to get this method to work.