Getting the camera image from within the SmartApp

I wonder if there is a way to obtain the image (frame) from the camera device from within the SmartApp code.

Note, I’m specifically talking about smartapp, since in a Device Handler code this task should be achieved by using getImage() method. But this method is for Device Handlers and does not seem to work from smartapps (or at least I didn’t manage to make it work for me).

From what I’ve seen in various smartapps that come as part of the IP Cameras device handlers, the actual bytearray of the image is never obtained. The smartapps just perform take() action and the image is displayed in the Latest section of the camera or in Notifications.

What I need to are bytes of the image so that I could send those to my email server or whatnot.

Is it possible?

This may still be possible with a custom device handler. I think SmartThings never offered “encoded image” as an official Attribute.

@RBoy is probably a good expert to consult.

Thanks for a pointer.

Actually, the Image Capture device capability offers an ‘image’ attribute, which the apps can potentially subscribe to, like this:

subscribe(camera, "image", imageEventHandler)

But it doesn’t work. There is no image event received by the handler. So I’m still puzzled.

The Capability Definition is in status “proposed”; so who knows if any DH has implemented it.

Furthermore, like most Capabilities, the domain/units of the Attribute are very poorly defined and no examples are given. What is an image in the form “string”? Is it a path to the captured file on AWS? Is it a Base64 encoded image? Or ?

https://docs.smartthings.com/en/latest/capabilities-reference.html#image-capture

reviewed 2018-2-20
name: Image Capture
status: proposed
attributes:
  image:
    schema:
      type: object
      properties:
        value:
          $ref: URL
      required:
        - value
    type: STRING
    setter: take
commands:
  take:
    arguments: [
      ]
public: true
id: imageCapture
ocfResourceType: x.com.st.imagecapture
version: 1

It won’t work because ST limits the number of characters you can store in an attribute. This used to work once up on a time but due to the ST architecture, heavy attributes were putting a LOT of load in the platform (synchronization issue) which were impacting other devices. So they’ve limited the number of characters you can use in an attribute to under 100 bytes. Only the DTH currently has access to the raw data AFAIK.

Got it, thanks!