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.
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.
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:
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.
http.repeat_request(), allows making one more request with an already opened connection.
The main arguments are quite similar to http.request().
http.close_connection(), allows to close the existing connection. A plugin can use only its own connections.
Main argument: unique ID of a request.
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.
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
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.
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.
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 Ezlo!