This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

Homey Image Grabber app

jordenjorden Member
edited April 2017 in Apps
I just created an "Image Grabber" for Homey. You can input the URL of an image file to this app inside a Homey flow, and then it will grab it and convert it to an "image token" that you can use to send the image data to the Telegram app. 

That's all it does, although in the future more apps could be made compatible with this type of imaging. 

It's quite cool, I use the snapshot URL of my IP cam (http://<IP>/img/snapshot.cgi for my IP cam, not every cam supports this or uses the same) to post images of the IP cam to Telegram using Homey.

It is posted at https://github.com/jordenc/image.grabber and submitted for approval to the Athom appstore (not yet available there).
«134

Comments

  • Cool stuff, now you need to update your email app so it contains a send image through email card ... :wink:
  • Very nice!
  • Cool, want to try this out, but can cant figure out the flows.
    Can you make a screenshot from your flows?
  • The first flow let u get the image. In my case a snapshot from a camera:



    And this is the 2nd flow. Sent the pic to Telegram bot:


  • The first flow let u get the image. In my case a snapshot from a camera:



    And this is the 2nd flow. Sent the pic to Telegram bot:


    @Rocodamelshe ;
    I See that you have a card with "stuur een afbeelding" from the App telegram. I have installed the latest version from telegram and use it for some time now, but i have only the card " stuur een bericht". Am i something missing here, besides the card "stuur een afbeelding"


  • Ahh that was te problem, had to set telegram to image.
    @glijie
    Download latest telegram app from github
  • 0burner0 said:
    Ahh that was te problem, had to set telegram to image.
    @glijie
    Download latest telegram app from github
    okay....thx!!!!! that works:-)
  • Please note that if you install the Telegram app from Github, only sending will work, your messages from Telegram will not be sent to Homey. That will only work with the latest version once it is approved by Athom.
  • jorden said:
    Please note that if you install the Telegram app from Github, only sending will work, your messages from Telegram will not be sent to Homey. That will only work with the latest version once it is approved by Athom.
    This is what i was waiting for a long time...It works great!!! bought you some beer or ..... , thx:-)


    PS: Selected the "telegram app" because image grabber is not there to select yet.
  • @glijie Thanks a lot! I've now updated it on d2c as well, you were too quick ;)
  • Working great!

    Only thing I found was that it doesn't work with HTTPS with my Foscam, HTTP works fine. 

    Something you can look into / add?
  • I will check that when I get the time! Is it a https with a valid certificate or with an invalid one? Does the app provide an error?

    I can probably work around it by setting a parameter.
  • It's just the certificate that is on the camera by default, haven't really looked into custom certificates on the camera, or how to import the CA's into Homey etc in order to setup the trust.

    So, I guess the problem could be that it doesn't trust the certificate. To be honest, I'm not sure how to check Homey's logs.

    I can say that if I run the same command via curl, I need to use the -k / --insecure option to ignore the cert errors.
  • Yeah that default certificate will probably generate an error. I will look into it when I have the time!
  • PekePeke Member
    Hoe does the second flow gets triggerd? srry im still a noob in this.
  • PekePeke Member
    Peke said:
    Hoe does the second flow gets triggerd? srry im still a noob in this.
    Already figured it out, used the wrong URL. working perfect now! very good job keep up the good work.

  • Can't get it to work.  :|
    Made two flows (grab image / send image).
    When I use 'send message' for telegram, I get a string as a result (GltZyBzcmM9Ii4uL3NuYXBQaWMvU25hcF8yMDE3MDQxOC0xMDA5NDguanBnIi8 PC9ib2R5PjwvaHRtbD4=)
    When I use 'send image', I don't get anything at all...

    I use the same cgi-url as Roco posted (and the url works in IE), so I guess that should be OK.
    Any ideas?  :)



  • That string seems to be quite alright, it should be a base64 encoded string. It might be a little too short if that's all of it (it doesn't decode well).

    Is it a http:// or https:// URL?
  • jorden said:
    That string seems to be quite alright, it should be a base64 encoded string. It might be a little too short if that's all of it (it doesn't decode well).

    Is it a http:// or https:// URL?
    I trimmed it a little (don't know if it contains sensitive info  ;) )
    It's http.

    When I test-run the grabbing flow manually, I get a green checkmark on the card. But not when I run the send flow.
    Very strange...
  • That's strange indeed. Probably the grabbing works well, but the sending in Telegram has problems.

    Does the URL provided only have an image, or is a HTML page that loads the image? (If you open it in your browser, is there a "view source" button or is it only the image?)

    I have submitted version 0.0.2 to the app store which does not check for valid certificates on https URL's. @Veldkornet (not yet approved)
  • @Fire69 it could also be that your image is not a JPG file. The Telegram app expects JPG files.
  • jordenjorden Member
    edited April 2017
    E-mail app on Github has been updated to support these image tokens as well (use the new action card "Send image token", don't put any other text in the message body). Submitted for approval in the appstore.
  • jorden said:
    @Fire69 it could also be that your image is not a JPG file. The Telegram app expects JPG files.
    Seems like it is: http://192.168.1.7:9999/snapPic/Snap_20170418-152903.jpg

    Does your image grabber store the file somewhere in Homey's storage?
  • The image grabber converts it to a base64 encoded string in memory (in the token).
    It seems to be okay looking at that URL. But it also seems that the URL is generated "on the fly", probably by loading a snapshot.cgi (or something similar). The image grabber will only work with the direct URL to the .jpg file, not with the snapshot.cgi (unless the snapshot.cgi outputs the image and nothing but than the image).

    (I am using snapshot.cgi because that's the name of the function on my cam, it is probably called differently on your cam).
  • Fire69Fire69 Member
    edited April 2017
    Seems like the page is an html with a jpg in it.
    I'll check with Roco how he got it working :smile:
  • Lets compare some on Slack and we put the findings in here. Sent u a PM on Slack.
  • Fire69Fire69 Member
    edited April 2017
    OK, stupid problem solved.  Apparently the url is case sensitive  :D
    So if you have a Foscam and use this url: /cgi-bin/CGIProxy.fcgi?cmd=snapPicture&usr=admin&pwd
    Make sure you type it exactly as shown here or it won't work.  :|

    [edit]
    Also, there are 2 url's available, snapPicture and snapPicture2.  You have to use snapPicture2, this one returns a jpeg, the other an html-page which won't work.
  • Awesome, guys :)
  • jorden said:
    I have submitted version 0.0.2 to the app store which does not check for valid certificates on https URL's. @Veldkornet (not yet approved)
    Confirmed that the https links are now working as well :)
  • It works great, but one question.

    Is it possible to add the ability to send the image to a channel so multiple users can see it?
Sign In or Register to comment.