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

Forum dédié aux problématiques concernant les scripts pour DomoticZ.
Entourez votre code et les logs avec les balises nommées code grâce au bouton <\>.
pigloox
Messages : 78
Inscription : 18 janv. 2016, 16:12

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

Message 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
Raspberry PI 3 & Raspbian 9 (Stretch) sur disque dur, Domoticz Beta Release,
RFX433E + USB Teleinfo + Zwave Stick
Modules Chacon DI-O, Fibaro, Qubino et sondes de températures
DreamL
Messages : 76
Inscription : 20 janv. 2017, 20:03

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

Message 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}
Domoticz 3.7115, raspberry pi3, (raspbian jessie).
rfx433 (Rfxcom) : sonde innovaley, 1wire (DS9490R) : DS2406 & DS18B20, Zwave (Stick G5) : fgms-001,fgsd-002,zw080.
Répondre