OsibotOne / osibot-duck

An Autonomous Surface Vehicle For Ocean Research
MIT License
1 stars 0 forks source link

Add SMS Support #1

Open Adam-Osibot opened 9 months ago

Adam-Osibot commented 9 months ago

We need to add support for reading, sending & deleting SMS messages from a 4G USB Dongle Modem.

Possible Solutions: https://github.com/colins44/gsm-sms https://blog.haschek.at/2021/raspberry-pi-sms-gateway.html Use Gammu?

Create a python script that:

  1. Sends an SMS message: sms.py send,0424672585,"Test Message Test"

  2. Receive all SMS messages: sms.py receive, sms.txt

  3. Delete all SMS messages: sms.py delete

Adam-Osibot commented 9 months ago

Device: 4G USB Modem Phone Number: 0459586164

Adam-Osibot commented 8 months ago

Setup 4G USB Dongle Modem

apt install gammu gammu-smsd usb-modeswitch git

lsusb -returns Bus 001 Device 005: ID 12d1:1c05 HUAWEI HUAWEI Mobile. 12d1 is the vendor code for Huawei and the string after that (1c05 in my case) is the product ID.

sudo usb_modeswitch -v 12d1 -p 14db -M '55534243123456780000000000000011062000000100000000000000000000' -this changes the USB to modem mode.

Great, now let's create a config file with the following content and store it in /etc/gammurc

[gammu] device = /dev/ttyUSB0 name = Bob connection = at logfile = /var/log/gammu.log

[smsd] service = files logfile = syslog

PIN = 1234

Increase for debugging information

debuglevel = 0

Paths where messages are stored

inboxpath = /var/spool/gammu/inbox/ outboxpath = /var/spool/gammu/outbox/ sentsmspath = /var/spool/gammu/sent/ errorsmspath = /var/spool/gammu/error/

Test if SMS is working: echo "some message" | gammu --sendsms TEXT 0424672585

Start daemon: gammu-smsd -d -c /etc/gammurc

If using daemon, test this way: gammu-smsd-inject TEXT 0424672585 -unicode -text "hello world from the daemon!"

Adam-Osibot commented 6 months ago

I have not been able to get the modem to switch to "Modem Mode", the command might need tweaking to get it to work.