Telegram Plug-in to send text, images and video notifications
-
@archers thanks!
I'm using curl, so I'm not sure why it's not working, but I'll take a look. Is this basic Auth we're speaking about?
@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
-
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
-
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
-
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
@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
-
@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