Page 1 of 1

Huawei 3G modem with domoticz

Posted: Sunday 03 April 2016 10:36
by smq
Hello friends,

I connected huawei 3g modem to my Raspberry PI via USB to add possibility to receive SMS commands and send SMSes to me with information when for example alarm is raised. I know that in domoticz is possible to use clickatel but I wan't to became independent of external service in case of lost internet connection.
I configured gammu-sms deamon and I can sending smses from linux console like that (using bash script):

Code: Select all

pi@raspberrypi ~ $ echo "text to be send" | sudo gammu-smsd-inject TEXT XXXXXXXXX
where XXXXXXXXX is of course my phone number.

The problem is when I'm trying to initiate the script from the domoticz.
I created dummy switch and in section "On action" I put this command:

Code: Select all

script:///home/pi/scripts/sms.sh
in sms.sh script is the same command like above. When I'm switching on the switch, then script is launching but sms is not comming out by gammu ;(
I getting an error:

Code: Select all

Sun 2016/04/03 10:33:45 gammu-smsd[16640]: Error in outbox on 'OUTC20160303_103321_00_+48XXXXXXXXX_sms0.smsbackup'
So then I need to kill gammu, remove outbox files from /var/spool/gammu/outbox and lanuch gammu again.
It's really strange, because script is working properly when I'm launching manually (from pi user and root as well).
Anybody have a

Re: Huawei 3G modem with domoticz

Posted: Sunday 10 April 2016 21:21
by Reinz
I made something similar, but with SMS Servertools3 and had the problem that the sms deamon could not move the text files (for the sms) in the spool directory from "outgoing" to "sent" due owner ship problems.

Here is my solution
viewtopic.php?f=23&t=10251&p=72192#p72192

Re: Huawei 3G modem with domoticz

Posted: Sunday 10 April 2016 21:53
by oliviers
Another solution to send SMS from DOMOTICZ is to install SMS GATEWAY (Available on Google Play) on an Adroid phone (In my case, I use an old phone just for this purpose -- of course it must have a SIM card!). It creates an SMS server on the phone.
Then from DOMOTICZ one can send SMS by inserting this command in a script:

Code: Select all

wget "http://192.168.0.19:9090/sendsms?phone=0123456789&text="$txt

Where: 192.168.0.19:9090 is the IP@/port of the SMS Gateway server in the Android phone
0123456789 is the destination phone number
txt contains the text to be sent

No need to sign up with clikatel!

Re: Huawei 3G modem with domoticz

Posted: Tuesday 21 February 2017 13:54
by mayyam
Can You point to app You are using ? It's a few of them.

Re: Huawei 3G modem with domoticz

Posted: Tuesday 25 July 2017 11:46
by MegaBOOBLIK
1. folder
/home/USER/domoticz/scripts/

2. file
sendsms.sh

Code: Select all

#!/bin/bash

# Write ./sendsms.sh MESSAGE
# Phone numbers separated by a space
PHONE="22222222222 3333333333 4444444444"

for p in $PHONE
 do
  echo $1 | gammu sendsms TEXT $p -unicode
 done
exit 0
3. Events
10.png
10.png (10.8 KiB) Viewed 1547 times
P.S. if u wana check gammu just
echo TEST | gammu sendsms TEXT 12345678901

12345678901 - phone number