commandArray = {}
if (devicechanged['PIR'] == 'On') then
os.execute('/home/pi/dtgbot/cam.sh')
os.execute('curl -s -X POST "https://api.telegram.org/botTOKEN/sendPhoto" -F chat_id=YOURCHATID -F photo="@/var/tmp/image.jpg"')
end
return commandArray
I will add an alarm switch aswell so as to only capture image when alarm on and motion detected.
Check out viewtopic.php?f=21&t=7279 for more Domoticz / Telegram uses.
jvdz wrote: ↑Friday 30 July 2021 11:15
Did you see the script I made to send a collage of multiple pictures taken at an interval with Telegram for this purpose?
This was going to be my next step or research. Thanks for this.
This command however does not work with my USB webcam. I have tried several different syntaxes from google search.
wget -O $SnapFile3 $DomoUrl"/camsnapshot.jpg?idx=3"
But luckily I do have a workaround to get the snapshot.
My example script retrieves the snapshot from domoticz, not the cam directly, so it could be you need to change the domoticz url to includes https and/or userid/password.
Jos
jvdz wrote: ↑Friday 30 July 2021 17:33
My example script retrieves the snapshot from domoticz, not the cam directly, so it could be you need to change the domoticz url to includes https and/or userid/password.
Jos
I read somewhere that other people also did not get the snapshot from a USB camera. Some got all green snapshot.
Also that the image url should display the image inside the browser and not be downloaded. Mine downloads everytime.
Last edited by Welsyntoffie on Saturday 31 July 2021 3:09, edited 1 time in total.
jvdz wrote: ↑Friday 30 July 2021 11:15
Did you see the script I made to send a collage of multiple pictures taken at an interval with Telegram for this purpose?
I got your script working 100% to one person. Only have one telegram account in the house now.
SO arming my system and sending snapshots whenever the PIR gets triggered worked, but I get snapshots every 10 seconds while the motion continues.
I made these modifications to prevent further sending of snapshots for the next 5 minutes...
Seems to be working fine.
commandArray = {}
if (devicechanged['PIR TV Room'] == 'On' and (uservariables['Send_Once'] == 'Off')) then
os.execute('/home/pi/dtgbot/cam_collage.sh &')
commandArray['Variable:Send_Once'] = "On"
commandArray['Variable:Send_Once_RESET'] = "Off"
end
if (devicechanged['PIR TV Room'] == 'Off' and (uservariables['Send_Once_RESET'] == 'Off')) then
commandArray['Variable:Send_Once_RESET'] = "On"
commandArray['Variable:Send_Once'] = 'Off AFTER 300'
end
return commandArray