AlarmDecoder Support on HE

I am attempting to convert the AlarmDecoder Smartthings smartapp/drivers to Hubitat. The AlarmDecoder system uses a nodejs server to communicate with ST. The big issue is I am not a coder and the Smartapp and parent driver have a decent amount of code. Originally I was going to try and attempt most of this myself, but even after looking through the driver/smartapp porting thread I found it to be a little over my head. Basically on the ST platform when setting up the SmartApp you would use the simulator option in the ST IDE to find the AlarmDecoder device on the network. Next the settings to access the panel would be configured through the ST mobile app.

I did manually install the Smartapp and all parent/child drivers including the main Network Appliance driver. The Network Appliance driver is configured so that the DNI is set to the IP of my AlarmDecoder device in HEX format. My AD device also has a static IP set. I do not have a good understanding with the way that HE will work when subscribing to events with nodejs and I think this is where I am having issues.

This is really the last item that I need to move off ST and then I can finally shut it down. Any other info that is needed please ask, I will try and provide as much as I can.

Below is the Network Appliance Configuration.

AlarmDecoder SmartApp

AlarmDecoder Network Appliance Driver

AlarmDecoder Child Drivers

Friendly bump, still looking for some assistance. Thanks.

A good starting point is here to help convert the ST apps/driver over to HE. Once you have the apps/driver ported over, try it and post any error messages here and I'm sure all the coders will jumping to help.

I did look over this already, but there is a decent amount of moving parts between the smartapp and drivers and this was a little over my head. One part I was getting hung up on was how subscribing to events over the LAN works on HE vs ST. I do not have the knowledge of the intricacies of Groovy and how the code differs from ST to HE, this is the main problem.

I added all code to the drivers/app section and currently installed the parent driver and all child drivers. Of course I know I need to replace the "phsyicalgraph" with hubitat for both drivers/apps which I have done.

What I find is that when attempting to install the Smartapp during this process you need to discover the AlarmDecoder device, but I receive a Error 500 when I am attempting to search. Does device discovery work from a smartapp? I can manually install the network appliance driver, but I need to know what to comment out in the smartapp in order to allow me to bypass the device discovery to actually get the smartapp installed.

From what I understand the nodejs server for AD uses upnppush notifications to communicate with the Hub.

Yes, you should be able to do UPNP discovery from smartapp. Any error in the logs?

here is an example of one that does it.

There are no errors in the logs, probably because the smartapp is actually failing to install.

Looks like a combination of things:

Anywhere you see page(name: "*****") and there are underscores in the name, remove so it's camel case.
See below for replacing "page_discover_devices" with "pageDiscoverDevices" but just in the name, leave titles and content alone.

Maybe @chuck.schwer can confirm if having underscores confuses the html link on the page. Looking at the html source on the config page, it might.

page(name: "page_discover_devices", title: titles("page_discover_devices"), content: "page_discover_devices", install: true, uninstall: false)

page(name: "pageDiscoverDevices", title: titles("page_discover_devices"), content: "page_discover_devices", install: true, uninstall: false)

Second if you see href(name: "*****") replace "name: "****"" with the "pageName" in the new camel case you did above.

Below I replaced name: "href_discover" with "pageDiscoverDevices" and removed the page: "page_discover_devices" parameter.

href(name: "href_discover", required: false, page: "page_discover_devices", title: titles("page_discover_devices"), description: descriptions("href_discover_devices"))

href("pageDiscoverDevices", required: false, title: titles("page_discover_devices"), description: descriptions("href_discover_devices"))

This got me to the second page, but you'll need to fix the other pages to get through the flow.

@raidflex Went ahead and made those changes here:

https://pastebin.com/UzDMawnE

I don't have an alarmdecoder, so I'm not able to go any farther in the flow.

1 Like

Thank you. This did work and I was able to install the app. It looks like it did also install the devices properly but I will need to go through these devices to check everything.

I am seeing this error in the logs when trying to send a command from the AlarmDecoder Device.

groovy.lang.MissingPropertyException: No such property: requestId for class: hubitat.device.HubAction on line 1052 (updated)

Below is the Network Appliance Driver, looks like its related to event subscriptions.

AlarmDecoder Network Driver

Thanks for pointing this out. We have found the cause of the underscores in names and hope to have a fix in the next release.

2 Likes

result.requestId = "SUBSCRIBE"

You should be able to remove line 1052. I looked at the source and it just seems to be used for debugging purposes later.

So I do not see that error anymore, but I still have an issue with the Network Appliance Driver it seems. When I intiaite a command, in this case "arm_stay" there is no command received on the AlarmDecoder server. I see the following in the HE log for the AD Network Driver. There is an apikey present I just removed it for security.

[dev:484](http://192.168.1.2/logs#dev484)2018-08-28 15:22:33.646:trace--- hub_http_post: host=192.168.1.2:5000, path=/api/v1/alarmdecoder/send?apikey=**************
[dev:484](http://192.168.1.2/logs#dev484)2018-08-28 15:22:33.643:trace--- send_keys
[dev:484](http://192.168.1.2/logs#dev484)2018-08-28 15:22:33.642:trace--- arm_stay

I looked at the http_post call and nothing looks wrong with it to me. Are you able to hit the server using just your browser?

http://192.168.1.2:5000/api/v1/alarmdecoder?apikey=*******

It looks like its working I get the following message.

That is odd, I took the code you uploaded and subbed out the host for a device on my network and it received a response, so I'm not sure what's up with it:

dev:14412018-08-28 16:54:27.398:trace--- update_state: new state ************** notready ************

dev:14412018-08-28 16:54:27.392:trace--- update_state

dev:14412018-08-28 16:54:27.387:trace--- parse_json

dev:14412018-08-28 16:54:27.362:info--- parse: mac: B827EB253A0 requestId: 000000000000

dev:14412018-08-28 16:54:27.279:trace--- hub_http_post: host=192.168.2.159:1882, path=/postTest?apikey=null

dev:14412018-08-28 16:54:27.274:trace--- send_keys

Yeah not sure what is going on. I noticed that the Mac=null for the Network Appliance. I looked at my Smartthings setup and it does display the mac address of AD server.

Also when I perform the refresh command from the network appliance I receive this output which actually shows the correct MAC of the AD server. Any other command like arm, disarm, etc, does not display the "parse:mac" in the logs.

[dev:484](http://192.168.1.3/logs#dev484)2018-08-28 21:41:58.866:trace--- update_state
[dev:484](http://192.168.1.3/logs#dev484)2018-08-28 21:41:58.865:trace--- parse_json
[dev:484](http://192.168.1.3/logs#dev484)2018-08-28 21:41:58.863:info--- parse: mac: B827EBBE0DB6 requestId: 000000000000
[dev:484](http://192.168.1.3/logs#dev484)2018-08-28 21:41:58.644:trace--- hub_http_get: host=192.168.1.2:5000, path=/api/v1/alarmdecoder?apikey=*************
[dev:484](http://192.168.1.3/logs#dev484)2018-08-28 21:41:58.640:trace--- handler.refresh

So I reinstalled the smartapp and drivers and now the MAC address shows up properly.

What I also noticed is that if I arm the system from the alarm panel, the Network Appliance device will show that the status has changed to armed. Although I do need to hit the refresh option in order for the status to change, but at least it does change.

What is still not working is when I initiate a command from the Network Appliance device, this does not trigger the command on the alarm decoder server. So it looks as if its only going in one direction.

Note: Both the HE and AD server are on the same VLAN and both have static IP reservations set in my PFsense box.

Bump.... Just seeing if anyone has some incite into this issue. Not sure if there is a change that would need to be done on the AD server side.

Without any errors in the log still having trouble tracking this issue down, If I arm/disarm from the AD web interface, HE does not update the status unless I manually hit "refresh" in the AD driver. But I still have no control over arm/disarm or any function from HE.

Going to http://192.168.1.2:5000/api/v1/alarmdecoder?apikey=******* shows the current AD status.