LOOKING TO MOVE FROM VERA but have CURL Commands to migrate

Hi Everyone - i've got Hubitat at home working great but my 7 year old Vera setup at cottage is something i'm hesitatnt to migrate due to some CURL commands the Vera uses to control turning on and off the HIKVISION cameras. I'm not an expert programmer so curious how i could execute this same command in Hubitat world?

Here it is: On Alarm disarm, Vera runs a scene which does an OS execute on the vera controller:

EXECUTE COMMAND IN VERA:
os.execute ("curl -X PUT -T /etc/cmh-ludl/CAMERA-ALARM-ON.xml http://user:pass@192.168.0.151:81/Event/Triggers/1/Notifications")

The XML Payload is stored on the Vera filesystem and contains the following which is what HIKVISION Camera expects. Pretty basic but it has worked flawless for 7 years (there is a similar Camera OFF sequence)

CONTENTS OF XML PAYLOAD FOR PUT COMMAND: CAMERA-ALARM-ON.xml

<?xml version="1.0" encoding="UTF-8"?>
<EventTriggerNotificationList version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
<EventTriggerNotification>
<id>2</id>
<notificationMethod>email</notificationMethod>
<notificationRecurrence>beginning</notificationRecurrence>
</EventTriggerNotification>
<EventTriggerNotification>
<id>3</id>
<notificationMethod>record</notificationMethod>
<notificationRecurrence>beginning</notificationRecurrence>
</EventTriggerNotification>
<EventTriggerNotification>
<id>4</id>
<notificationMethod>HTTP</notificationMethod>
<notificationRecurrence>beginning</notificationRecurrence>
</EventTriggerNotification>
<EventTriggerNotification>
<id>8</id>
<notificationMethod>FTP</notificationMethod>
<notificationRecurrence>beginning</notificationRecurrence>
</EventTriggerNotification>
</EventTriggerNotificationList>

1 Like

I believe this can best be done using the built-in app WebCoRE. I've included screenshots of a mock Piston wherein these two things happen:

(1) Define a variable, called Payload here, containing the XML you pasted above (instead of having it saved into a file);

(2) Execute a Web request, in the form of a PUT, sending the aforementioned variable to the special URL (which also could have been passed via variable, but for the sake of illustration, I just hard-coded it into the PUT task, as shown).

The problem with using Rule Machine -- the traditional powerhouse app for automations in HE -- for this is that RM does not permit certain special/HTML characters in variables, even if you escape them. The second thing to realize is that, even though your Hubitat has a File Manager (like Vera), there's no immediate facility I'm aware of for sending out the contents of a file. Someone will surely correct me if I've missed something, such as whether special considerations need to be taken for sending pre-formatted TEXT instead of JSON. I'm not a WebCoRE expert.

P.S. WELCOME TO HUBITAT, because it runs rings around your old hub!!

2 Likes

Thank you for this - will the webcore run local to the hub? If so this seems perfect - thank you.

Yes Hubitat superior on many fronts!!

Yes, WC runs locally to the HE hub. It even became a native / built-in app a few months back. Only the WC Dashboard editing happens in the Cloud, for reasons.

In case you have a ton of logic / automation to move from your Vera, consider using a 3rd party app like Reactor or Node Red to help you decommission the old hub in stages. For example, recreate one of your Vera "Scenes" in Multi-System Reactor, and disable it on Vera. Then once your Hubitat is up and ready, simply unpair Device X from Vera, pair it with HE, and update the Reactor workflow to see the new platform.

Certainly not mandatory, but an opportunity to take your time with the transition, and learn a bit about Maker API (the primary means of connecting externally to Hubitat) as well as Rule Machine, Room Lighting, Button Controller, Mode Manager (highly underrated) and other purpose-built apps where you will ultimately recreate everything you had going on Vera.

Thx for the tips! Besides this camera logic/xml. API call, the Vera is only doing basic things. It was only this one routine that was holding me back and now I will take the plunge. Thank you!

Suffice to say, whatever questions you wind up having, someone in this Forum will help you tackle it.