Vistacam API

I am looking for more details on the API for the Ezlo Vistacam Using the API tool, I can see the device (hub.devices.list), so it’s clearly exposed via the API

I am connecting to the hub via WebSockets, and I can see motion events come across from the camera.

But is there a way to do more - grab screenshots, set device parameters (ex. tun motion on or off, set the LED, etc.).

I can send JSON to the API to control lights, door locks, etc., I assume I can do the same with the camera? But, I’m not finding any documents on the JSON structure / capabilities.

Any pointers?

Thanks.

1 Like

Hello @robotman

You could use the items list of the device. To check the device items:

{
    "method": "hub.items.list",
    "id": "_ID_",
    "params": {
        "deviceIds": [
            "deviceId0"
        ]
    }
}

Or to check the settings:

{
   "method":"hub.device.settings.list",
   "id":"_ID_",
   "params": {
      "deviceIds": [
         "deviceId0"
     ]
   }
}

Note that you would need to replace deviceId0 with the camera’s Id and use calls to set the items and settings as desired. Note that modifying settings may affect a device’s functionality. If you need assistance, please reach out to support at support@ezlo.com.

I am also interested in this topic. I have a VistaCam 1203 doorbell cam.

Using the API Tool I listed all its “Items” for the device ID of the main device type -

"deviceTypeId": "foscam_vistacam1203",
{
  "api": "1.0",
  "error": null,
  "id": "1677589749826",
  "method": "hub.items.list",
  "result": {
    "items": [
      {
        "_id": "61f20e9d123e431219fbc8d2",
        "deviceId": "61f20e90123e431219fbc8a1",
        "enum": [
          "closed",
          "opened"
        ],
        "hasGetter": true,
        "hasSetter": false,
        "name": "audio_stream",
        "show": true,
        "value": "closed",
        "valueFormatted": "closed",
        "valueType": "token"
      },
      {
        "_id": "61f20e9d123e431219fbc8d3",
        "deviceId": "61f20e90123e431219fbc8a1",
        "enum": [
          "create",
          "delete"
        ],
        "hasGetter": false,
        "hasSetter": true,
        "name": "audio_stream_control",
        "show": true,
        "value": "",
        "valueFormatted": "",
        "valueType": "token"
      },
      {
        "_id": "61f20e9d123e431219fbc8d4",
        "deviceId": "61f20e90123e431219fbc8a1",
        "hasGetter": true,
        "hasSetter": false,
        "name": "camera_stream",
        "show": true,
        "value": {
          "cloudLiveStreamUrl": "",
          "localRtspUrl": "rtsp://192.168.0.101:5554/61f20e9d123e431219fbc8d4"
        },
        "valueFormatted": "",
        "valueType": "cameraStream"
      },
      {
        "_id": "61f20e9d123e431219fbc8d5",
        "deviceId": "61f20e90123e431219fbc8a1",
        "enum": [
          "idle",
          "ring"
        ],
        "hasGetter": true,
        "hasSetter": false,
        "name": "doorbell_state",
        "show": true,
        "value": "idle",
        "valueFormatted": "idle",
        "valueType": "token"
      },
      {
        "_id": "61f20e9d123e431219fbc8d6",
        "deviceId": "61f20e90123e431219fbc8a1",
        "hasGetter": false,
        "hasSetter": true,
        "name": "format_sd_card",
        "show": true,
        "value": 0,
        "valueFormatted": "0",
        "valueType": "int"
      },
      {
        "_id": "61f20e9d123e431219fbc8d7",
        "deviceId": "61f20e90123e431219fbc8a1",
        "hasGetter": false,
        "hasSetter": true,
        "maxValue": 60,
        "minValue": 15,
        "name": "make_recording",
        "show": true,
        "value": 0,
        "valueFormatted": "0",
        "valueType": "int"
      },
      {
        "_id": "61f20e9d123e431219fbc8d8",
        "deviceId": "61f20e90123e431219fbc8a1",
        "hasGetter": false,
        "hasSetter": true,
        "name": "reset",
        "show": true,
        "value": 0,
        "valueFormatted": "0",
        "valueType": "int"
      },
      {
        "_id": "61f20e9d123e431219fbc8d9",
        "deviceId": "61f20e90123e431219fbc8a1",
        "hasGetter": true,
        "hasSetter": false,
        "name": "sd_card_capacity",
        "show": true,
        "value": 14902,
        "valueFormatted": "14902",
        "valueType": "int"
      },
      {
        "_id": "61f20e9d123e431219fbc8da",
        "deviceId": "61f20e90123e431219fbc8a1",
        "hasGetter": true,
        "hasSetter": false,
        "name": "sd_card_free_space",
        "show": true,
        "value": 262,
        "valueFormatted": "262",
        "valueType": "int"
      },
      {
        "_id": "61f20e9e123e431219fbc8db",
        "deviceId": "61f20e90123e431219fbc8a1",
        "enum": [
          "not_present",
          "unformatted",
          "formatting",
          "ok",
          "read_only"
        ],
        "hasGetter": true,
        "hasSetter": false,
        "name": "sd_card_status",
        "show": true,
        "value": "ok",
        "valueFormatted": "ok",
        "valueType": "token"
      },
      {
        "_id": "61f20e9e123e431219fbc8dc",
        "deviceId": "61f20e90123e431219fbc8a1",
        "hasGetter": false,
        "hasSetter": true,
        "name": "stop_recording",
        "show": true,
        "value": 0,
        "valueFormatted": "0",
        "valueType": "int"
      },
      {
        "_id": "61f20e9e123e431219fbc8dd",
        "deviceId": "61f20e90123e431219fbc8a1",
        "hasGetter": false,
        "hasSetter": true,
        "name": "take_snapshot",
        "show": true,
        "value": 0,
        "valueFormatted": "0",
        "valueType": "int"
      },
      {
        "_id": "61f913d3123e431861dde865",
        "deviceId": "61f20e90123e431219fbc8a1",
        "elementType": "array.string",
        "elementsMaxNumber": 2,
        "hasGetter": true,
        "hasSetter": false,
        "name": "camera_diagnostic",
        "show": true,
        "value": {
          "61f20e9d123e431219fbc8d4": [
            "cloud_tunnel_established",
            "cloud_tunnel_rejected",
            "camera_accumulated_delay"
          ]
        },
        "valueFormatted": "",
        "valueType": "dictionary"
      }
    ]
  },
  "sender": {
    "conn_id": "002026ef-aa69-4add-8e22-625d1df2c7be",
    "type": "ui"
  }
}

Items of interest seen in the above list are “Camera Stream” this is the RTSP stream. Note its IP proxied is via the Ezlo Plus controller, not the VistaCam’s own direct IP address.

“make_recording” presumably if you change its value from 0 to 1 it would make a recording?

"_id": "61f20e9d123e431219fbc8d7",
        "deviceId": "61f20e90123e431219fbc8a1",
        "hasGetter": false,
        "hasSetter": true,
        "maxValue": 60,
        "minValue": 15,
        "name": "make_recording",
        "show": true,
        "value": 0,
        "valueFormatted": "0",
        "valueType": "int"

“stop_recording”

"_id": "61f20e9e123e431219fbc8dc",
        "deviceId": "61f20e90123e431219fbc8a1",
        "hasGetter": false,
        "hasSetter": true,
        "name": "stop_recording",
        "show": true,
        "value": 0,
        "valueFormatted": "0",
        "valueType": "int"

“take_snapshot”

"_id": "61f20e9e123e431219fbc8dd",
        "deviceId": "61f20e90123e431219fbc8a1",
        "hasGetter": false,
        "hasSetter": true,
        "name": "take_snapshot",
        "show": true,
        "value": 0,
        "valueFormatted": "0",
        "valueType": "int"

The motion sensor portion of the camera device is presumably a child device with a different device ID and device type.

"deviceTypeId": "foscam_vistacam1203_sensor.motion",

Listing this devices items I got this, showing the motion sensors trip state the value being true or false etc.

{
  "api": "1.0",
  "error": null,
  "id": "1677590471009",
  "method": "hub.items.list",
  "result": {
    "items": [
      {
        "_id": "61f20e91123e431219fbc8a3",
        "deviceId": "61f20e91123e431219fbc8a2",
        "hasGetter": true,
        "hasSetter": false,
        "name": "motion",
        "show": true,
        "value": false,
        "valueFormatted": "false",
        "valueType": "bool"
      }
    ]
  },
  "sender": {
    "conn_id": "002026ef-aa69-4add-8e22-625d1df2c7be",
    "type": "ui"
  }
}

As for the cameras settings I got these settings listed from the API

"name": "reboot"
"name": "contrast"
"name": "flip_image"
 "name": "time_format"
 "name": "chime_type"
"name": "hue"
"name": "wifi_signal"
"name": "ir_led"
"name": "voice_enable_state"
"name": "power_type"
"name": "ringtone"
"name": "speaker_volume"
"name": "speaker_volume"
"name": "network_auto_adaptability"
"name": "date_format"
"name": "reset_image_settings"
"name": "privacy_mask"
"name": "saturation"
"name": "high_dynamic_range"
"name": "mirror_image"
"name": "chime_ring_time"
"name": "sharpness"
"name": "status_led"
"name": "brightness"

I know the OP said he was using the Websockets, but I’d use this myself with the Ezlo controllers HTTP Server API.

So for example to take a snap shot image using this Item information:

"_id": "61f20e9e123e431219fbc8dd",
        "deviceId": "61f20e90123e431219fbc8a1",
        "hasGetter": false,
        "hasSetter": true,
        "name": "take_snapshot",
        "show": true,
        "value": 0,
        "valueFormatted": "0",
        "valueType": "int"

You would end up with a HTTP command like this:

https://192.168.0.101:17000/v1/method/hub.item.value.set?_id=61f20e9e123e431219fbc8dd&value_int=1

How you then view that snap shot image? I am not sure, presumably somewhere in the Vera or Mios mobile app.

Where are the snap shots and recordings stored? Presumably on the Ezlo cloud, can you hot link to them via a URL ?

Say if you wanted to display the snap shot image in a 3rd party app etc.

Similarly, you could use:

{
    "method": "hub.item.value.set",
    "id": "_ID",
    "params": {
        "_id" : "61f20e9e123e431219fbc8dd",
        "value": 1
    }
}

The snapshot should be visible on the app: Go to Doorbells > History.
Recordings and snapshots are stored on the Cloud storage cloud, you would need the file uuid and key and use https://download-cloud.ezlo.com/?uuid=UUID&key=KEY

In the Android Vera app I can get in to History by going to “Doorbells” from the main menu, but its just a blank white page.

In the Android MIOS app instead you have to select “More” then "Doorbells to get in to “History” section. However I have no history in there either, I get a spinning circle for a while then just a blank page.

Thanks - I understand the basics, but I’m trying to get more specifics…

For example:
How do you tell the camera to capture an image?
How do you access that image?
How do you stream video from the camera?
etc.

I’ve figured out how to listen for Websockets events for motion, noise, but not the image.

The Vera app shows that the camera has an SD card in it? Is that true? If so, can I grab images locally? I’m hoping for a non-cloud option.

Is any of the camera API documented anywhere?

Thanks.

Thanks! This is very helpful.

Re:

“items of interest seen in the above list are “Camera Stream” this is the RTSP stream. Note its IP proxied is via the Ezlo Plus controller, not the VistaCam’s own direct IP address.”

I see the audio_stream listed, but not the video_steam. Any pointers there?

RTSP uses port 554, I assume I can open an RTSP stream to the hub’s IP and port 554 to get the stream? I’ll have to play around with that…

It is. When you add the camera, a number of virtual / child devices are available - motion, sound (possible others depending on the camera).

Actually, I see it now via the API tool. It’s called “camera_stream”.
Also notice “cloudLiveStreamUrl”

_id: “63fd4ae9077e90123b60d64f”

deviceId: “63fd4ae3077e90123b60d622”

hasGetter: true

hasSetter: false

name: “camera_stream”

show: true

value: Object {“cloudLiveStreamUrl”:“”,“localRtspUrl”:“rtsp://192.168.1.176:5554/63fd4ae9077e90123b60d64f”}

valueFormatted: “”

valueType: “cameraStream”

1 Like

Think I was able to add my VistaCam rtsp stream in to TinyCam Pro and VLC which are 3rd party apps.

No username or password required either. Which could be a bad thing.

Yes you found it.

We covered snap shot image above already.

Although I currently cannot see my cameras “History” images in their Ezlo apps.

Thanks. What UUID and Key though? How do I obtain those via the API?

If I make a “snapshot” call with:

https://192.168.1.176:17000/v1/method/hub.item.value.set?_id=63fd4ae9077e90123b60d657&value_int=1

I get back:

{“error”:null,“id”:“63fe31ef077e90127daaf68a”,“result”:{}}

Which implies it was successful.

is id the UUID? If so, what about the key?

Thanks,

It would be nice to be able to steam to a browser, but RTSP is not supported in any browsers. WebRTC seems to be the standard supported, but it doesn’t look like the camera supports WebRTC?

I’m wondering if what I want to do can be done without a bunch of transcoding / servers… ?

I should add - Home Assistant seems to do this (although I’m working on a custom solution, so it doesn’t help me in this case, but may help others):

They must support WebRTC as they are using WebRTC in their own webpage dashboard at

https://ezlogic.mios.com/#/login?redirect=%2F

How you get a stream url for WebRTC however I dont know.

It’s not visible through the API, I’ll check what other options we can share with you.

Yeah their repsonse should ideally include the UUID maybe. And the key whatever that is? Or perhaps the key is private and shouldn’t be in any http response.

@cw-kid @robotman

shouldn’t be in any http response.

Correct. I’ll confirm any other options to get the file.

It looks like they use the <Video> tag to embed a media player into the webpage.

@Alvaro_Ochoa do you know if it’s possible for that player to be shared / made available so others can use it in their web apps? In my case, I’m working on an Ezlo-specific app (which I will make available) and would love to be able to show video streams similar to the Mios dashboard.

@cw-kid This is what it looks like on the Mios dashboard page:

> 
> <video data-v-7fe596e8="" id="0" autoplay="autoplay" playsinline="" volume="0.5" controls="controls" src="" poster=""
>     class="player" data-event_data='
>     {
>         "type": "widget",
>         "details": {
>           "index": "0_0_0_0_0",
>           "type": "VideoPlayer"
>         },
>         "link": {
>           "provider": "Ezlo",
>           "details": {
>             "controllerId": "90004084",
>             "device": {
>               "id": "63fd4ae3077e90123b60d622",
>               "name": "VistaCam",
>               "category": "camera",
>               "controller_id": "90004084"
>             },
>             "item": {
>               "id": "63fd4ae9077e90123b60d64f",
>               "name": "camera_stream",
>               "type": "cameraStream",
>               "value": {
>                 "cloudLiveStreamUrl": "",
>                 "localRtspUrl": "rtsp://192.168.1.176:5554/63fd4ae9077e90123b60d64f"
>               },
>               "valueFormatted": ""
>             }
>           }
>         },
>         "configuration": {}
>       }
>     '
>     style="outline-style: none; outline-color: rgb(26, 155, 252); outline-offset: 0px; border-radius: 16px; overflow: auto;">
> </video>

Which renders as:

I’m not familiar with WebRTC. But an Ezlo dev told me in the past they were using WebRTC.

So the above code you got from the Ezlo dashboard page?

So its still using rtsp right, to show the cameras feed embedded within the web page.

Also interested in the web app you are making for Ezlo controllers? Can you share any more details?

Thanks.