How to: send image from camera with Telegram.
Posted: Thu Jun 16, 2016 2:08 pm
If you want to send a picture from your camera With Telegram (after motion detected), this is how you can do it.
You make a chain with your camera, a motion detector and after the motion detector a module “save to file” and also “application runner”.
You can setup your motion detector yourself (I put post record on 0 seconds).
In the module save to file you have to define the path, for example: “/home/pi/picture.jpg”, the Type of stored files is Images (JPEG), the image saving intervals I have put on 30 seconds (you can play with this if you want more pictures) and precord 0 seconds.
In the module application runner you have to define the program:
curl -s -X POST "https://api.telegram.org/bot<token>/sendPhoto" -F chat_id=<id-receiver> -F photo="@/home/pi/picture.jpg"
Parameters is empty and interval of running is 30 seconds (you can play with this if you want more pictures).
Some explanation about Telegram, I find this a very useful guide: https://www.domoticz.com/wiki/Telegram_Bot.
Take a little time and you will see it is easy and very useful (also for other applications)! You will have to fill in your own token and id of the receiver of the Telegram-message send by your Xeoma-server.
I use curl –s –X POST to “run” the URL on linux.
You can test the full URL for sending the picture in a browser (for example Chrome or another one on that server) to see if it is functioning!
Some remarks:
- The picture send is a picture taken from the preview and not of the “high quality” stream of your camera. I have asked Xeoma about it. If I have news, I will report it.
- I was not successful with the module “request sender”, somehow the URL is not transmitted…..
- I am using Xeoma (latest standard version), Raspberry PI3-server and Mac/Windows-client.
You make a chain with your camera, a motion detector and after the motion detector a module “save to file” and also “application runner”.
You can setup your motion detector yourself (I put post record on 0 seconds).
In the module save to file you have to define the path, for example: “/home/pi/picture.jpg”, the Type of stored files is Images (JPEG), the image saving intervals I have put on 30 seconds (you can play with this if you want more pictures) and precord 0 seconds.
In the module application runner you have to define the program:
curl -s -X POST "https://api.telegram.org/bot<token>/sendPhoto" -F chat_id=<id-receiver> -F photo="@/home/pi/picture.jpg"
Parameters is empty and interval of running is 30 seconds (you can play with this if you want more pictures).
Some explanation about Telegram, I find this a very useful guide: https://www.domoticz.com/wiki/Telegram_Bot.
Take a little time and you will see it is easy and very useful (also for other applications)! You will have to fill in your own token and id of the receiver of the Telegram-message send by your Xeoma-server.
I use curl –s –X POST to “run” the URL on linux.
You can test the full URL for sending the picture in a browser (for example Chrome or another one on that server) to see if it is functioning!
Some remarks:
- The picture send is a picture taken from the preview and not of the “high quality” stream of your camera. I have asked Xeoma about it. If I have news, I will report it.
- I was not successful with the module “request sender”, somehow the URL is not transmitted…..
- I am using Xeoma (latest standard version), Raspberry PI3-server and Mac/Windows-client.