Telegram snapshot only when not at home
Moderator: leecollings
-
fransiefrans
- Posts: 59
- Joined: Sunday 14 June 2015 13:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: stable
- Location: Netherlands
- Contact:
Telegram snapshot only when not at home
hi,
I want to get snapshots send to telegram when my frontdoor opens and when uservariableor switch nobody home is on.
Since last update there is a possibility to send snapshots in blocky but I think that's only with email notification, not with telegram.
Is it possible to execute a script in blocky?
If not, is there an other solution?
The snapshot.sh script is working only when I execute in putty, somehow not when I put the script in the on-action of a switch. I got it working but when I did a fresh install of domoticz I still didn't manage to get it to work in domoticz. I use script:/// and changed the rights to 755. Any ideas how I could fix this?
I want to get snapshots send to telegram when my frontdoor opens and when uservariableor switch nobody home is on.
Since last update there is a possibility to send snapshots in blocky but I think that's only with email notification, not with telegram.
Is it possible to execute a script in blocky?
If not, is there an other solution?
The snapshot.sh script is working only when I execute in putty, somehow not when I put the script in the on-action of a switch. I got it working but when I did a fresh install of domoticz I still didn't manage to get it to work in domoticz. I use script:/// and changed the rights to 755. Any ideas how I could fix this?
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Telegram snapshot only when not at home
With my php script and telegram bot integration I receive the snapshot of the motion detection always. But they ony make a notification sound when I'm not a sleep.
For that I use 2 virtual switches: 'Away' and 'Sleep'. They control everything in the home.
Once the switches are there it's as simple as:
For that I use 2 virtual switches: 'Away' and 'Sleep'. They control everything in the home.
Once the switches are there it's as simple as:
Code: Select all
<?php
if($SAway=='Off') shell_exec('/home/pi/script.sh');
-
fransiefrans
- Posts: 59
- Joined: Sunday 14 June 2015 13:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: stable
- Location: Netherlands
- Contact:
Re: Telegram snapshot only when not at home
My Domoticz won't execute any sh script. in Putty the snapshots are send to telegram. When I try the same script with an on action I only see:
im using the following at on action: script:///home/pi/domoticz/scripts/bash/deurbel.sh
any ideas?
Code: Select all
Executing script: /home/pi/domoticz/scripts/bash/deurbel.shim using the following at on action: script:///home/pi/domoticz/scripts/bash/deurbel.sh
any ideas?
-
fransiefrans
- Posts: 59
- Joined: Sunday 14 June 2015 13:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: stable
- Location: Netherlands
- Contact:
Re: Telegram snapshot only when not at home
I'm still trying to get the scripts working from domoticz without any luck. Has anyone an idea?
-
Derik
- Posts: 1605
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Telegram snapshot only when not at home
Perhaps use a dummy switch that you switch with ping your phone or a pir..fransiefrans wrote:I'm still trying to get the scripts working from domoticz without any luck. Has anyone an idea?
And when this dummy is off run the script...
Quotum of attachments sorry
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
fransiefrans
- Posts: 59
- Joined: Sunday 14 June 2015 13:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: stable
- Location: Netherlands
- Contact:
Re: Telegram snapshot only when not at home
Thanks for your reply.
Is that any different from a doorcontact or dummy switch switched by hand?
Is that any different from a doorcontact or dummy switch switched by hand?
-
Derik
- Posts: 1605
- Joined: Friday 18 October 2013 23:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version: BETA
- Location: Arnhem/Nijmegen Nederland
- Contact:
Re: Telegram snapshot only when not at home
i do not understand php or more like that stuff.
Only switching a dummy give more freedom..
To active a script u can use a dummy with http to:
This how i activate a script:
Please let me see the script..
Only switching a dummy give more freedom..
To active a script u can use a dummy with http to:
This how i activate a script:
Code: Select all
script:///home/linaro/domoticz/scripts/bash/hue/kachel_1_aanPlease let me see the script..
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
-
fransiefrans
- Posts: 59
- Joined: Sunday 14 June 2015 13:22
- Target OS: Raspberry Pi / ODroid
- Domoticz version: stable
- Location: Netherlands
- Contact:
Re: Telegram snapshot only when not at home
Im trying the following script on an dummy:
Code: Select all
#!/bin/sh
#SendMsgTo=$1
SendMsgTo=$TelegramChatId
#################################################################
IP="192.168.2.2" # IP address Camera
##########################################################
SnapFile=$TempFileDir"snapshot.jpg"
if ping -c 1 $IP > /dev/null ; then # if IPCAM is online then:
wget -O - http://192.168.2.1:8080/camsnapshot.jpg?idx=1 > $SnapFile
sleep 2
curl -s -X POST "https://api.telegram.org/bot"$TelegramBotToken"/sendPhoto" -F chat_id=$SendMsgTo -F caption="er wordt aangebeld" -F photo="@$SnapFile"
else
curl --data 'chat_id='$SendMsgTo --data-urlencode 'text=IP-cam niet beschikbaar.' 'https://api.telegram.org/bot'$TelegramBotToken'/sendMessage'
fi-
pj-r
- Posts: 140
- Joined: Wednesday 17 December 2014 17:30
- Target OS: Linux
- Domoticz version: V3.8650
- Location: Jyväskylä, Finland
- Contact:
Re: Telegram snapshot only when not at home
I do the same with rtsp camera in LUA.
TakeSnapshot is virtual switch with 5sec off delay defined. Its becouse rtsp snapshot is quite slow..
TakeSnapshot is virtual switch with 5sec off delay defined. Its becouse rtsp snapshot is quite slow..
Code: Select all
-- snapshot script
commandArray = {}
if (devicechanged['TakeSnapshot'] == 'On') then
--os_time = os.date("%d.%m.%y %H:%M:%S")
print('Snapshot!')
os.execute('/usr/bin/avconv -i rtsp://user:[email protected]:554/ch0_0.h264 -frames:v 1 -an -y /home/user/domoticz/snapshots/snapshot.jpg')
print('Done')
-- now we can post the image to telegram
os.execute('/usr/bin/curl -s -X POST "https://api.telegram.org/bot112233445:YOURTOKEN/sendPhoto" -F chat_id=-CHATID -F photo="@/home/user/domoticz/snapshots/snapshot.jpg" &')
end
return commandArrayLXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors
Who is online
Users browsing this forum: No registered users and 1 guest