New Telegram Action

Thanks for the hint.
I have checked everything again very thoroughly and found the issue indeed in my openhab.cfg.
Some copy / paste issue with the chatID. So you were absolutely right! @paolo_denti.
It did not have anything to do with incompatibility of the different .jars.

I use the openHAB designer and with .cfg files there is obviously not a proper syntax handling!?
Which editor (within OH_Designer should I use?) - currently just text editor which somehow caused the issue.
Thanks @hakan & @watou as well.

It works, id mistake for me too (I used @botname sintax).
Any chance to upload also a jpg? It would be wonderful for secure camera apps :smiley:

2 Likes

And merged by @watou already :smile:

Expect the new functionality on tonights Jenkins build.

Wiki updated as well :wink:

1 Like

Thanks!!

sorry for the dumb questionā€¦ but where can I download last version?

Telegram action is included in 1.8 and not included in 1.7. So you can either build it on yourself or wait until the 11th of January, when the 1.8 will become official

got here in ā€œaddonsā€ :smiley: https://openhab.ci.cloudbees.com/job/openHAB/

it works very well, thxs!

(bella Paolo, posso mandarmi da casa il fotogramma della ipCam quando il sensore di movimento ĆØ triggerato :smiley: )

I canā€™t get this to work. SendTelegram works great, but sendTelegramPhoto just doesnā€™t appear to do anything. Is there anything I can do to debug it?

[Edit] to expand! the image is accessed via a url like this ā€œhttp://username:password@ipaddress/snapshot.cgiā€ I looks like this doesnā€™t work with sendMail either, so is that likely to be the issue?

You must be sure that your url returns only the raw image data and not an html page containing an image or something similar

This would not work with the sendMail action for the reason that the username:password@ part is not accepted by the external Java mail library. The current known workaround in that case is to attach the image from a simple URL (perhaps by first fetching the image to a /tmp directory using curl or similar, and then attaching it to the email with a file:///tmp/... URL.

You could try this approach with the Telegram action, and perhaps rename the file extension in the process (but I think the Telegram action is smart enough to figure out the fileā€™s real type regardless of extension).

Looks like that is the issue. Itā€™s a html page, with a img tag pointing really oddly to the same url. I can only imagine some sort of header is being sent when the request is for the image.

Iā€™ll have a try and what @watou has suggested and use curl to dump the picture locally and see if that works.

Iā€™ve made the change suggested by @watou and that works great for sendmail, but Iā€™m guessing that telegram doesnā€™t accept file:///tmp/webcam.jpg as an input to the send picture command.

Iā€™ve tested using the sample (open-hab logo) and that works fine, so Iā€™m guessing the issue is loading from file://

i will implement an accept header from http url in order to accept only images.
This could solve issues similar to your one where probably the web server is sending back appropriate content depending on accept header

Iā€™ve looked at this again and I think Iā€™m wrong. What I thinkā€™s happening is chrome and itā€™s extensions are adding html to whats returned.

Really I need to try and figure out how to see the actions logs.

The problem is the following one: the schema of username and password in the url is managed by the browsers. It is not managed by the standard httpclient.

I added a method with basic authentication here (https://github.com/paolodenti/openhab), in branch "telegram"
It tested it and it looks working. If it works for you as well I will issue a pull request.

how to use it; the sendTelegramPhoto accepts two new optional parameters for basic auhentication (username and password)
sendTelegramPhoto(ā€œbot1ā€, ā€œhttp://ipaddress/snapshot.cgiā€, null, ā€œusernameā€, ā€œpasswordā€)

Waiting for a feedback

Any chance you can provide me with a build? I donā€™t have a java build environment configured Iā€™m afraid. Very happy to help test it however!

I just submitted a pull request that i tested on myself (setting up a basic authenticated server). As soon as it will be deployed by the jenkins you will find it in the builds.

I will then modify the wiki accordingly (after the pull request execution)

Iā€™ve just had a little look here https://openhab.ci.cloudbees.com/ and couldnā€™t see anything obvious. Iā€™ll take another look in a few hours and see if itā€™s ready then (assuming thats the correct place to look!)

Thanks for this, really appreciate it!