Script not executed Topic is solved

Post Reply
Crispy78
Posts: 7
Joined: Sunday 27 August 2017 22:27
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Script not executed

Post by Crispy78 » Monday 05 March 2018 22:27

Hello community,

On this forum I've found a (doorbell) BASH-script that will capture an image from my camera and send it through Telegram to our mobiles.

Code: Select all

#!/bin/sh
SnapFile="/var/tmp/camsnapshot.jpg"

# Get snapshot via Domoticz server
wget -O $SnapFile "http://**IP_ADDRESS_DOMOTICZ**:**PORT**/camsnapshot.jpg?idx=1"

# Send Telegram message with image
curl -s -X POST "https://api.telegram.org/bot**TOKEN**/sendPhoto" -F chat_id=-**CHATID** -F photo="@$SnapFile" -F caption="Er staat iemand aan de deur!"

# Remove Image
/bin/rm $SnapFile
I've made a doorbell (a WeMos D1 running TASMOTA with relay-board that will turn on or off the power supply of the doorbell) and created the device in Domoticz. Whenever the doorbell is triggered it will show up in the Domoticz and device logs as respectively 2018-03-05 21:10:05.900 MQTT: Topic: domoticz/in, Message: {"idx":3,"nvalue":1,"svalue":""} and 2018-03-05 21:10:05 On. On the same time Domoticz retrieves an OFF-notification.

I've created a blocky-event that should run the script
Blocky_script.jpg
Blocky_script.jpg (15.24 KiB) Viewed 576 times
Whenever I press the doorbell button in Domoticz, the script will run and the doorbell will ring. Whenever I use the doorbell the script isn't run and the doorbell will ring like expected. All devices are running the latest stable versions. When am I doing wrong or have I forgotten to set?

It has worked like I wanted it, but after a crash all settings where lost since I haven't made notes or backups :-(

Crispy78
Posts: 7
Joined: Sunday 27 August 2017 22:27
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Script not executed

Post by Crispy78 » Tuesday 06 March 2018 21:15

I got it working, for my own future reference:
The script (deurbel.sh):

Code: Select all

#!/bin/sh
SnapFile="/var/tmp/camsnapshot.jpg"

# Get snapshot via Domoticz server
wget -O $SnapFile "http://**IP_ADDRESS_DOMOTICZ**:**PORT**/camsnapshot.jpg?idx=1"

# Send Telegram message with image
curl -s -X POST "https://api.telegram.org/bot**TOKEN**/sendPhoto" -F chat_id=-**CHATID** -F photo="@$SnapFile" -F caption="Er staat iemand aan de deur!"

# Remove Image
/bin/rm $SnapFile
The Blocky-event:
Blocky_script.jpg
Blocky_script.jpg (19.66 KiB) Viewed 541 times
The switch (Switches) is setup as a doorbell no on/off action has been assigned and the doorbell command (Setup -> Settings -> Other) is "on".

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest