sur le RPI3 : adresse IP1 :192.168.xx.yy
Message retourné : Error: Script: Insecure script command!
Sur un autre RPI4 qui héberge le site web API REST ça fonctionne. adresse IP2: 192.168.xx.xx
La notification HTTP envoie avec un script bash un message vers le serveur web API REST qui envoie le message en sms vers un portable via un modem GSM.
Paramètrage de la notification sur les 2 RPI:
Code : Tout sélectionner
script:///home/pi/domoticz/scripts/sendsms.sh "#TO" "#MESSAGE"Code : Tout sélectionner
#!/bin/bash
#
rawurlencode() {
local string="${1}"
local strlen=${#string}
encoded=""
local pos c o
for (( pos=0 ; pos<strlen ; pos++ )); do
c=${string:$pos:1}
case "$c" in
[-_.~a-zA-Z0-9] ) o="${c}" ;;
* ) printf -v o '%%%02x' "'$c"
esac
encoded+="${o}"
done
echo "${encoded}" # You can either set a return variable (FASTER)
REPLY="${encoded}" #+or echo the result (EASIER)... or both... :p
}
rawurlencode "$2"
error=$(curl -X POST http://192.168.xx.xx/send.php? -d phone=%2B$1 -d text="$2" )
echo $error #affichage du retour d'info