Page 2 sur 2

Re: Problème d'envoi de SMS via GAMMU par Domoticz

Publié : 07 janv. 2017, 15:00
par pigloox
Oui j'avais essayé de l'installer jusqu'au moment ou le configurateur automatique à pris mon stick z-wave pour ma clé 3G et là ce fut le drame... Domoticz n'a pas aimé, je ne sait pas ce que ça a modifié mais je me suis retrouvé avec une config plantée... :evil: du coup c'est pour ça que je suis partit sur gammu seul

Re: Problème d'envoi de SMS via GAMMU par Domoticz

Publié : 20 janv. 2017, 20:19
par DreamL
Bonjour tlm

J'ai mis en place ce script (cf plus bas) hier soir. Je l'utilise pour les notifications avec cette commande
script:////home/pi/domoticz/scripts/sendsms.sh "#MESSAGE"
Les sms partent bien de domticz.

J'ai commenté ce qui ne me servait pas
Si ca peut t'aider

Code : Tout sélectionner

GAMMUCONF="/home/pi/.gammurc"
DEFAULTPHONE="+336XXXXXXXX"
DEFAULTMESSAGEFILE="/home/pi/domoticz/SMSServices/defaultsms.txt"
LOGFILE="/home/pi/domoticz/SMSServices/sendsms.log"
LOGENABLED=false

#PINCODE="1234"

#==============================================================
# Check the number of arguments and store them
if [[ $# -eq 2 ]]; then
  PHONE=$1
  MESSAGEFILE=$2
  LOGENABLED=true
elif [[ $# -eq 1 ]]; then
  PHONE=${DEFAULTPHONE}
  MESSAGEFILE=$1
  LOGENABLED=true
elif [[ $# -eq 0 ]]; then
  PHONE=${DEFAULTPHONE}
  MESSAGEFILE=${DEFAULTMESSAGEFILE}
else
  echo "Invalid number of arguments. Must be 2 or 0."
  exit 0
fi

#==============================================================
# Check the 3G dongle is available
if [[ ! -c ${DEVICE} ]]; then
  echo "Device ${DEVICE} is not available. Might be a driver issue."
  if [[ $(lsusb | grep ${USBID}) == "" ]]; then
    echo "The 3G dongle is not recognized on the USB bus"
  fi
  exit 0
fi

#==============================================================
# Function to send the SMS
sendSMS() {
sudo /usr/bin/gammu -c ${GAMMUCONF} sendsms TEXT ${PHONE} -text ${MESSAGEFILE$sudo /usr/bin/gammu -c ${GAMMUCONF} sendsms TEXT ${PHONE} -text ${MESSAGEFILE$ $  sudo /usr/bin/gammu -c ${GAMMUCONF} sendsms TEXT ${PHONE} -text ${MESSAGEFIL$
  RETVALUE=$?

  # Log everything
#  if [[ ${RETVALUE} -eq 0 && ${LOGENABLED} = true ]]; then
#    DATE=$(date +"%x-%X")
#    ONELINEMESSAGE=$(cat ${MESSAGEFILE} | tr "\\r\\n" " ")
#    echo "${DATE};${PHONE};${ONELINEMESSAGE}" >> ${LOGFILE}
#  fi
#  return ${RETVALUE}
}

sendSMS

# Check the status code of the gammu command. If it's 121, then it means the 3G dongle
# is first waiting for the pin code to be entered
#if [[ $? -eq 121 ]]; then
#  sudo /usr/bin/gammu entersecuritycode PIN ${PINCODE}