Ezlo hubs WS and LUA API in html format, offline version

Here is offline version of Ezlo hubs WS and LUA APIs in html format which is covering:

Hub:

  • Broadcasts
  • Errors
  • API Versioning
  • Smart Devices
  • Gateways
  • Devices
    • Categories
    • Devices Types
    • List of integrated devices
  • Items
    • Item Names
    • Value Types
    • Value Enumerations
  • Settings
    • Setting Types
  • User Functionality
    • Room Methods
    • House Modes
    • Scenes
    • Favorites
  • Plugins
    • ZWave
      • Broadcasts
    • 2GIG
      • Broadcasts

Scripting:

  • Lua
  • Modules
    • Core
      • Functionality
      • Events
      • Values
      • Objects
    • Storage
    • Network
    • Timer
    • Zwave
      • Events
      • Values
      • Objects
    • Zigbee
      • Events
      • Objects
    • 2GIG
      • Events
      • Values
    • Scenes

The current version is 1.4:
api_doc_1.4.zip (1.3 MB)

3 Likes

Ezlo hubs WS and LUA API was updated to version 1.4 with descriptions for new broadcasts, requests and modules.

Updated broadcasts:
hub.user.notification - the notification of user about specific types of alerts. hub.device.firmware.update.progress - the notification about firmware update to device status hub.device.firmware.download.progress - the notification about firmware download from remote link status
hub.setting.updated - notification about controller settings value changes

Added to user functionality section:

  • EZVIZ Plugin for Hikvision EZVIZ cameras
  • Siren plugin
  • HTTP-Server API

Added to scripting section:

  • HTTP module. The module provides the ability to make HTTP requests.
  • Cameras module. Module provides an access to IP cameras functionality (live streaming, recording, sending to remote storage etc.).
  • PlugHub module. Module provides an access to a PlugHub functionality.
  • WaterValve module. Module provides an access to a WaterValve functionality.
  • Speaker Module. The module provides the ability to play sound using an integrated speaker.
  • Logging module. Logger module provide functionality for printing diagnostic information to logs with different severity levels.
2 Likes

Can you tell me more about this please.

I have Hikvision IP cameras.

I don’t want the cameras snapshots and videos stored on the Ezlo cloud necessarily.

But I would like an Ezlo plugin that can read the Hikvision’s alarm stream, so I can have virtual motion sensors on the Ezlo hub linked in to the Hikvision cameras onboard PIR sensors.

I can do this currently on my Vera Plus with @Sorin’s implementation file here, which I modified slightly to suit my own needs.

Thanks

can you please expand on what a user can do with this functionality please?

1 Like

Shouldn’t this be published to https://api.ezlo.com?

Hi @blacey,
Public version was updated to 1.4 as well.

1 Like

I’m missing something or?


how can i run the following command?

Examples

Add any camera model and set the timeout to 1 minute:

{
   "method": "hub.extensions.plugin.run",
   "id": "_AUTO_370954",
   "params": {
      "script": "HUB:ezviz/scripts/discovery",
      "scriptParams": {
         "action": "start_dhcp_discovery",
         "timeout": 60
      }
   }
}

there is no hub.extensions.plugin.run in the api

Where did you get that example code from ? Its for adding a camera?

Can you not run it as “Custom”

Supported models

  • VistaCam 702
  • VistaCam 1200

So what’s the plan if any? For support for none Ezlo, Ezviz and Hikvision cameras ?

Thanks

Add any camera model via UDP:

{
   "method": "hub.extensions.plugin.run",
   "id": "_AUTO_370954",
   "params": {
      "script": "HUB:ezviz/scripts/discovery",
      "scriptParams": {
         "action": "udp_discovery"
      }
   }
}

Yields no Results.

Add any camera model via DHCP:

{
   "method": "hub.extensions.plugin.run",
   "id": "_AUTO_370954",
   "params": {
      "script": "HUB:ezviz/scripts/discovery",
      "scriptParams": {
         "action": "start_dhcp_discovery",
         "timeout": 60
      }
   }
}

Yields no Results.

Does the plugin have to be installed first ?

Searching the folders and files on the hub for “Ezviz” using WinSCP I find nothing.

Can someone explain how this is meant to work and will it only work for VistaCAMs ? Not real Ezviz or Hikvision cams ?

@Oleh

Can you add an example please for Add Camera stream:

You have one for cameras.create_audio_stream but not for add_camera_stream.

HTTP Module supports HTTP Client functionality and provides the ability to make any custom HTTP requests directly from Lua scripts.
The module supports the next types of HTTP request methods: GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE. Default value: GET.

A very important part of the module – events:

1.http_data_send - notifies about ready to send the next portion of data of a request. This event will be received after establishing a connection with the HTTP server and if the last field was false in http.request() or http.repeat_request() methods. Also, this event can be triggered again if not all data were sent in this session.
2. http_data_received, notifies about the answer on request or new portion of data. It triggers when the “receiving data buffer” is full or all bytes were received (according to the Content-Length or Transfer-Encoding headers), or two end lines are received. When caching is disabled, it triggers immediately after receiving a new portion of data.
3. http_connection_closed, notifies about the closing of a connection. The main possible reasons and codes are described in the documentation.

API of the module is very easy to use:

  1. http.request(), configures and starts a new asynchronous HTTP request. Returns connection identifier.
    Main arguments for this request:
  • Full URL for making a connection (can contain custom port)
  • Path to file with certificates chain to verify the server’s certificate in PEM format( in HUB:zwave/certs/server.ca format )
  • Path to file with the private key of the client in PEM format (only if the server requires client authentication via client certificates)( in HUB:zwave/certs/server.ca format )
  • Path to file with a certificate of the client in PEM format (only f server requires client authentication via client certificates)( in HUB:zwave/certs/server.ca format )
  • Skip any security checks: check date, domain, and self-signed certificates criteria. Default value: false.
  • Type of request. Possible value: GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE. Default value: GET.
  • Type of sending content
  • User name, user password
  • Data for sending
    and others.
  1. http.repeat_request(), allows making one more request with an already opened connection.
    The main arguments are quite similar to http.request().
  2. http.close_connection(), allows to close the existing connection. A plugin can use only its own connections.
    Main argument: unique ID of a request.
  3. http.send_data(), the method for sending the next portion of data for the existing request. A plugin can use only its own connections.
    Main arguments:
  • Unique ID of a request
  • Data for sending
  • It’s the last part of the data or not. Default value: true. If it is not the last part of data then http_data_send event will be generated when existing data would be sent.
  1. http.get_connection_info(), allows to get the main information about a connection. A plugin can ask only about its own connections.
    Main arguments:
  • Unique ID of a request
    As return value:
  • Full URL for making a connection (can contain custom port)
  • User data that was passed to an http.request() call. If user_data is null, the value will not be set.
  • Size of data that can be sent per one script execution via http.send_data() method
1 Like

Hi @cw-kid,

We are planning to push the build with cameras support/EZVIZ plugin and siren plugin next week.
Preparing now the manual - how to work with cameras API/plugins and will post it here asap.

I see understood.

So this Ezviz plugin is only for VistaCams right?

Not actual Ezviz or Hikvision IP cameras?

The API can work with all cameras which supporting RTSP stream,
but full integration of specific cameras provided by the EZVIZ plugin.
Current version of the plugin supporting:

  • VistaCam 702
  • VistaCam 1200

Of course we have big plans about supporting different cameras.

As long as we can read the Hikvision alarm stream for PIR events and create a virtual motion sensor device based upon the cameras PIR, I’ll be happy.

And to be able to view the Rtsp stream in any future Elzo dashboard app of course.

As stated its possible today in Vera, using Sorin’s Hikvision implementation file with some mods.

@cw-kid, here is the example for add_camera_stream

local cameras = require("cameras")

cameras.add_camera_stream( "588b7eb528b12d03be86f36f", 
    					   "Camera Name",
    					   "rtsp://admin:719347a355d0031f4000153a0230b122702fd144@192.168.33.101:554/ISAPI/Streaming/channels/1",
    					   "Hall camera"		   
)
1 Like

Here is the general flow for working with RTSP streaming cameras.

Sequence of camera live stream creating/removing:
local subscriberId = subscribe( “HUB:cameras/scripts/event_handler” )
add_camera_stream
create_live_rtsp_stream
delete_live_rtsp_stream
remove_camera_stream
unsubscribe( subscriberId )

Sequence of stream creating/removing to cloud:
local subscriberId = subscribe( “HUB:cameras/scripts/event_handler” )
add_camera_stream
create_stream_saving_to_cloud
start_stream_saving_to_cloud
stop_stream_saving_to_cloud
delete_stream_saving_to_cloud
remove_camera_stream
unsubscribe(subscriberId)

Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules