I have a script /home/pi/sendsms.sh
which runs ok from the console
for instance
/home/pi/sensdsms.sh test123
send a sms (with gammu)
If I try to call the same script from the notifications settings web page in domoticz with:
URL action script:///home/pi/sendsms.sh #MESSAGE
I see the following error in log if I press the Test button
Error: Error executing script command (/home/pi/sendsms.sh). returned: 26624
I must be overlooking something...
Custom HTTP/Action for Notifications
Moderator: leecollings
-
- Posts: 19
- Joined: Friday 12 July 2013 15:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NL
- Contact:
- nayr
- Posts: 354
- Joined: Tuesday 11 November 2014 18:42
- Target OS: Linux
- Domoticz version: github
- Location: Denver, CO - USA
- Contact:
Re: Custom HTTP/Action for Notifications
your script needs an exit code, 0 for success >0 for failure.. looks like its returning a number greater than 0
try adding exit 0 to the end of your script
I am not sure about command arguments in the script:// URI, never tried it personally it may not work as expected, might try wrapper scripts with pre-defined messages.
also make sure you have #!/bin/bash as the top line, if you omit it and your using bash logic you may get a failure that you dont see from a command line (because your cli is bash and the default shell is not)
try adding exit 0 to the end of your script
I am not sure about command arguments in the script:// URI, never tried it personally it may not work as expected, might try wrapper scripts with pre-defined messages.
also make sure you have #!/bin/bash as the top line, if you omit it and your using bash logic you may get a failure that you dont see from a command line (because your cli is bash and the default shell is not)
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
-
- Posts: 19
- Joined: Friday 12 July 2013 15:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NL
- Contact:
Re: Custom HTTP/Action for Notifications
Thanks for your help
My Script
Tried it form a on action of a domoticz device
script:///home/pi/domoticz/scripts/sendsms.sh
The script runs from the console. It now executes from a domoticz device without errors in the domoticz log. From Domoticz gammu doesn't do it's magic.
Must be something really silly I'm overlooking
My Script
Code: Select all
#!/bin/bash
gammu --sendsms TEXT +316xxxxxxx -text "test"
exit 0
script:///home/pi/domoticz/scripts/sendsms.sh
The script runs from the console. It now executes from a domoticz device without errors in the domoticz log. From Domoticz gammu doesn't do it's magic.
Must be something really silly I'm overlooking
-
- Posts: 19
- Joined: Friday 12 July 2013 15:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: NL
- Contact:
Re: Custom HTTP/Action for Notifications
Solved
Script
Notification setup
URL/Action
Small bug: If a device sends a notification #SUBJECT and #MESSAGE are identical. The Test button sends "Domoticz test" as #SUBJECT and "Domoticz test message!" as #MESSAGE
Script
Code: Select all
#!/bin/bash
sms=$1" "$2
/usr/bin/gammu --config /home/pi/.gammurc --sendsms TEXT +316xxxxxxx -text "$sms"
exit 0
URL/Action
Code: Select all
script:///home/pi/domoticz/scripts/sendsms.sh "#SUBJECT" "#MESSAGE"
Who is online
Users browsing this forum: Google [Bot] and 1 guest