Telegram Plug-in to send text, images and video notifications
-
@therealdb done
-
@therealdb
Sorry db, thanks PerH - 'nuff said, properly chastened
-
I have set this up for some text notifications and it is working as it should, thanks for a very nice plugin!
With the added support in Reactor it makes a nice pair!I also tested sending an image (in the format http://url/folder/image.jpg) and it works as specified in the users guide on github.
What I cannot get to work however is when the url to the image contains user and login, which is required to get an image from my cameras.
I.e. the url to the image is :http://user:passwd@192.168.x.y/jpg/image.jpg
.
I have tried encoding it withhttps://www.urlencoder.org/
, but it does not seem to work.Any ideas on how to solve this?
//ArcherS
-
@therealdb yes I think it should be basic authorisation to send credentials via http in the form of
http://username:password@example.com/
to retreive an image from an Axis IP Camera and send it via Telegram.Maybe there is a better way to do it?
I have used curl calling a .sh file from OpenLuup for sending a few commands to the camera (for enabling/disabling privacy mask) in the past.What I did try, but failed was to get the camera to send an image directly. It has support for sending images via http/https, but I didn't get that to work. So far I have done it via email instead since it supports that as well.
I think however that quite a few cameras do not support sending themselves, so getting it to work in the plugin with basic auth would hopefully be of use anyway.
//ArcherS
-
Try with
curl --user daniel:secret http://example.com/
And if it's working, I'll try a patch.
-
Edit: I tested to modify mu curl from
curl --digest -u daniel:secret...
tocurl --user daniel:secret...
and that does not seem to work. It seems as if the Axis cameras require Digest mode for auth.Original post:
@therealdb not sure how to test, I tried from the prompt on my OpenLuup PC running Ubuntu but it didn't seem to work, I got "This server could not verify that you are authorized...".But in the .sh file that I call from OpenLuup I have:
curl --digest -u daniel:secret "http://192.168.x.x/axis-cgi/admin/param.cgi?action=update&root_Image_I0_Overlay_MaskWindows_M0_Enabled=no"
(This is a cgi command to the camera.)
And that curl works.Let me know if I should test something else!
//ArcherS
-
Will have to have a look at this!
C
-
therealdbreplied to ArcherS on Dec 12, 2020, 9:37 AM last edited by therealdb Dec 12, 2020, 4:37 AM
@archers said in Telegram Plug-in to send text, images and video notifications:
But in the .sh file that I call from OpenLuup I have:
curl --digest -u daniel:secret "http://192.168.x.x/axis-cgi/admin/param.cgi?action=update&root_Image_I0_Overlay_MaskWindows_M0_Enabled=no"
(This is a cgi command to the camera.)
And that curl works.@ArcherS I've pushed v0.22 to GitHub https://github.com/dbochicchio/vera-Telegram
I've not created a release, so just get the S_* and L_* files.
There's a new param, so you should use this
luup.call_action("urn:bochicchio-com:serviceId:VeraTelegram1", "Send", { Text="This is a protected endpoint!", VideoUrl="https://media.giphy.com/media/3o84sIqsVAJNfWyjy8/giphy.gif" UrlParams="--digest -u daniel:secret" -- <== curl parameters! }, 515)
Try it and let me know. I'll probably release it later as a packaged version.
-
@therealdb thank you for the update!
I have tried it and it does not quite work.
The Lua code is executed ok (with the added comma as below), and I get a message in Telegram.
The text is ok, however instead of getting an image I get "camsnapshot117439654.gif" (the number is different each time). The gif does not seem to contain anything.
The url I call generates a .jpg file, I do not know why arrives as an empty .gif.Any ideas?
(Btw, there is a small typo in the luup.call_action, the comma is missing after the VideoUrl line. It should be:)
luup.call_action("urn:bochicchio-com:serviceId:VeraTelegram1", "Send", { Text="This is a protected endpoint!", VideoUrl="https://media.giphy.com/media/3o84sIqsVAJNfWyjy8/giphy.gif", UrlParams="--digest -u daniel:secret" -- <== curl parameters! }, 515)
//ArcherS
-
The gif pet is coming from VideoUrl, I was wrong. You should use ImageUrl if it’s a still image.
-
@therealdb now it works!
For my Axis camera that seems to require Digest mode for curl authentication I use the following to send an image:
luup.call_action("urn:bochicchio-com:serviceId:VeraTelegram1", "Send", { Text = "Motion in garage", ImageUrl = "http://192.168.x.x/jpg/image.jpg", UrlParams = "--digest -u daniel:secret" }, 515)
Thanks for the addition to an already nice plugin!
//ArcherS