Ezlo WIFI / IP Device Generator plugin Templates on the marketplace (Hikvision Cams)

With the Ezlo IP Device Generator plugin (formally called WIFI Device Generator) it is possible for users to create device templates and share them with other users, by publishing their templates to the Marketplace.

I was playing around with this today and I have published two templates for controlling somethings on Hikvision IP cameras.

  1. Start or Stop Manual Recording on the camera, using this template you can create a virtual ON / OFF switch device into your Ezlo dashboard / Vera mobile app.

Turning ON the virtual switch will start manual recording, turning OFF the virtual switch will stop manual recording on the camera.

You could then use this virtual switch in your Meshbot rules Actions, for example a true action could be to turn on the virtual switch to start recording when an armed sensor is tripped and the false action could be to turn off the virtual switch to stop the camera recording etc.

You need to copy down the template from the Marketplace to the “My Wifi Device Templates” area then press the button to create your device.

Give your virtual switch device a name. Enter the local IP address of your Hikvision camera and use port 80. ** Enter admin as the user name and enter your cameras admin password and click the “Create Device” button.

** UPDATE - The plugin dev says this has changed now and the username and password fields here are no longer for HTTP devices, but only to be used for MQTT. So you need to now leave these username and password fields blank and instead do the following:

Go to this website and encode your username:yourpassword into base64, copy the entire resulting string.

I have updated the templates in the Marketplace to work with this new method using an Authorization header instead, once you have downloaded my Template(s) to your My IP Device Templates area, you will need to edit it and then paste your base64 string in the “value” field after the word “Basic” with a space like this:

Basic YWRtaW46eW91cnBhc3N3b3Jk

You need to do this for both the “Set On” and “Set Off” sections as shown in this example screen shot.

** Then after creating your device, in the dashboard and Vera mobile app you will see your new ON / OFF virtual switch etc.

image

To test its working turn ON the virtual switch for a few minutes then turn it OFF again, you can then login to your cameras admin page and go to “Playback”

“Manual” recordings are marked as Yellow in the timeline. If you click on the yellow marker and then press the “Play” button, that clip should then playback etc.

  1. The second template I made, creates a virtual ON / OFF switch to control the “Motion Detection” setting and enables or disables that particular setting.

Configuration → Event → Basic Event → Motion Detection Tab → Enable Motion Detection

Note - To test if your ON / OFF virtual switch is actually changing this setting, you may need to refresh your browser each time, to monitor if that tick box is being enabled or disabled when using the virtual switch. It doesn’t seem to change dynamically.

Having the virtual switch turned ON enables the “Motion Detection” setting. Having the virtual switch turned OFF disables the “Motion Detection” setting.

image

To use this template again you need to copy it down from the marketplace to your “My Wifi Device Templates” area and then click the create device button.

Again you need to give your virtual switch device a name. Enter the local IP address of your Hikvision camera and use port 80. Enter admin as the user name and enter your cameras admin password and click the “Create Device” button.

If you have several Hikvision cameras, you can create multiple virtual switches from these templates. Just change the local IP address to the address of your next camera etc.

UPDATE NOTE - There seems to be some duplicate templates in the Market place, I have asked them to remove my old ones.

However the new working ones are the ones that have Information showing when you press the Info button like this and are currently version 1.0.21

image

2 Likes

And for those of you wanting to know a bit more about how I created my templates.

  1. Start or Stop Recording Template


I’m using the Hikvision ISAPI HTTP API of the camera(s).

Start Recording (On)

Content Type Field - application/x-www-form-urlencoded

Header Key Authorization Header Value Basic your-base64-string

HTTP Method = PUT

WiFi Device Command field - /ISAPI/ContentMgmt/record/control/manual/start/tracks/101

Stop Recording (Off)

Content Type Field - application/x-www-form-urlencoded

Header Key Authorization Header Value Basic your-base64-string

HTTP Method = PUT

WiFi Device Command field - /ISAPI/ContentMgmt/record/control/manual/stop/tracks/101

I used the 101 main stream if you want to use the 102 sub-stream instead then you would need to edit these commands.

  1. “Motion Detection” setting enabled or disabled


For changing this particular setting on a camera I have to send a HTTP request with an XML data payload

“Motion Detection” Setting Enabled (On)

Data field - <MotionDetection xmlns="http://www.hikvision.com/ver20/XMLSchema" version="2.0"> <enabled>true</enabled> <MotionDetectionLayout version="2.0"> </MotionDetectionLayout> </MotionDetection>

Content Type Field - application/xml

Header Key Authorization Header Value Basic your-base64-string

HTTP Method = PUT

WiFi Device Command field - /ISAPI/System/Video/inputs/channels/1/motionDetection

“Motion Detection” Setting Disabled (Off)

Data field - <MotionDetection xmlns="http://www.hikvision.com/ver20/XMLSchema" version="2.0"> <enabled>false</enabled> <MotionDetectionLayout version="2.0"> </MotionDetectionLayout> </MotionDetection>

Content Type Field - application/xml

Header Key Authorization Header Value Basic your-base64-string

HTTP Method = PUT

WiFi Device Command field - /ISAPI/System/Video/inputs/channels/1/motionDetection

3 Likes

great work @cw-kid !
Controlling IP based devices now becomes easy.

15 posts were merged into an existing topic: Ezlo - WiFi device generator plugin is on the Market place