Unfortunately there is not yet a function available in dzVents for sending a camera snapshot using Telegram.
I made some minor changes to a Bash scripts found in topic Motion detector with ESP8266 and HC-SR501.
Code: Select all
#!/bin/sh
# $1 = Chat ID
# $2 = Caption
# $3 = Disable Notification (true or false)
TelegramToken="12345678:AABBCCDDEEFFasdfjasdhfkashdf"
SnapFile="/var/tmp/camsnapshot.jpg"
# Get snapshot via Domoticz server
wget -O $SnapFile "http://192.168.123.100:8080/camsnapshot.jpg?idx=1"
# Send Telegram message with image
curl -s -X POST "https://api.telegram.org/bot$TelegramToken/sendPhoto" -F chat_id=$1 -F caption="$2" -F disable_notification=$3 -F photo="@$SnapFile"
# Remove SnapFile
/bin/rm $SnapFile
Parameters:
1. Chat ID
2. Caption (Text shown under the snapshot send)
3. Disabled Notification (when true, the notification is silent)
In my dzVents script I added the line:
Code: Select all
os.execute('bash /home/pi/domoticz/scripts/telegram_snapshot.sh "-12345678" "Camera Snapshot" false &>/dev/null &')
More about running Bash files in the background: Running Bash Commands in the Background the Right Way