After messing around for a couple of days I just can't figure it out myself. I've searched a lot of topics but can't seem to get it work. I'm not a die hard code programmer so I hope someone can help me out. After creating a Telegram bot that sends me a notifications when a scene is triggered, I wanted to go to the next level; send an message with a camera snapshot attached to it.
I got the following working for sending a simple text message with the Telegram API:
luup.inet.wget('https://api.telegram.org/[botID]/sendMessage?chat_id=[ChatId]&text=Hello world',5);I'm using the Foscam C1 camera's where you can get a snapshot by using the following URL:
http://[ip-adres]:[port]/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=[username]&pwd=[pw]The API from Telegram uses the following command where you can send a image based on a URL or local directory:
https://api.telegram.org/[botID]/sendPhoto?chat_id=[chatID] &photo=[image.jpg]')So far so good. All the above commands work separately from each other. I can send a random image from the net over the Telegram API in Vera with:
luup.inet.wget(https://api.telegram.org/[botID]/sendPhoto?chat_id=[chatID] &photo=[image.jpg]')Where I get stuck is saving a local snapshot of the Foscam to the Vera. If found the following command in a
topic from 2012 and I'm not sure if this is still up-to-date:
os.execute('curl -o /tmp/[image.jpg] http://[ipadres]:[port]/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=[username]&pwd=[pw])With this command I'm expecting a jpg file in the /tmp/ folder. It does create a file but its always empty and shows a CGI -2 error in the created file, that indicates an wrong username or password. If i copy the same URL in the browser, I get a snapshot of the camera. I'm kinda of stuck at the moment and hope someone could help me in the right direction.
I'm using a Vera Edge Plus with the latest firmware (1.7.2608)