Help porting alarm system bridge

Sorry to keep spamming the forum with questions. New user, trying to get the main motion detectors in my house linked into Hubitat, so that Rooms Manager lights work again. Thanks @bangali

I'm attempting to create child devices (an alarm system, that has 8 motion detectors). There is communication between the alarm system and Hubitat, as I can arm the alarm through Hubitat and all 8 child devices are listed on the device page, but there is something wrong with the coding about adding a child device. The child devices are not added, or there is another step I'm not sure how to do. (How to add a child device?? )

Log errors There are 8 of each of these, one for each Motion detector.
Couldnt add device, probably already exists: groovy.lang.MissingMethodException: No signature of method: dev15385275343371522413665.addChildDevice() is applicable for argument types: (java.lang.String, java.lang.String, org.codehaus.groovy.runtime.GStringImpl, java.lang.Long, java.util.LinkedHashMap) values: [Hubitat, Open/Closed Sensor, alarmchildzone1, 1, [name:MD - Front Door]]

[dev:33](IP Address/logs#dev33)2018-10-03 10:46:11.443:debugTrying to add child with name: MD - Front Door, ID: alarmchildzone1 to 1

Here is the appropriate spot in the Device Code (there is more, this is just the appropriate code). Full Code here: https://1drv.ms/t/s!AnXEg8RBC3NHld5BgaBlQm7uynBkgw (although that is still with the SmartThings language).

 def ZoneCreateZoneDevices()
{
 	// This will create child devices
 	// The child devices are created in the handler for the /getzonenames response
 	log.debug "Requesting List of Alarm Zones"
 	getAction("/getzonenames")
 }
 
 def ZoneRemoveZoneDevices()
 {
 	// This will remove all child devices
 	log.debug "Removing Child Zone Devices"
 	try
 	{
 		getChildDevices()?.each
 		{
 			try
 			{
 				deleteChildDevice(it.deviceNetworkId)
 			}
 			catch (e)
 			{
 				log.debug "Error deleting ${it.deviceNetworkId}, probably locked into a SmartApp: ${e}"
 			}
 		}
 	}
 	catch (err)
 	{
 		log.debug "Either no child devices exist or there was an error finding child devices: ${err}"
 	}
 }
 
 
 def ZoneTestFunction()
 {
 	// This function creates a test device, which may be needed due to some random problems that exist when creating child devices
 	// due to issues in the SmartThings API
 	// log.debug "Got here inside the test function"
 	log.debug prename
 	if (device.currentValue("createzonedevices") == "cancreatezonedevices")
 	{
 		log.debug "state correct"
 	}
 	
 	try
 	{
 		def curdevice = getChildDevices()?.find { it.deviceNetworkId == "alarmchildzonetest"}
 		if (curdevice)
 		{
 			//Do nothing as we already have a test device
 		}
 		else
 		{
 			addChildDevice("hubitat", "Motion Detector", "alarmchildzonetest", device.hub.id, [name: "alarm zone test device", label: "Alarm Zone Test Device", completedSetup: true])
 		}
 	} 
 	catch (e)
 	{
 		log.error "Couldnt find device, probably doesn't exist so safe to add a new one: ${e}"
 		addChildDevice("hubitat", "Motion Detector", "alarmchildzonetest", device.hub.id, [name: "alarm zone test device", label: "Alarm Zone Test Device", completedSetup: true])
 	}
 }
 
 
 // This will configure the device to talk to SmartThings
 def configure()
 {
 	def cmds = []
 	log.debug "Configuring Alarm (getting zones+types, configuring IP/port/timeout)"
 	cmds << getAction("/status")
 	
 	def requeststring = "/config?ip_for_st=${device.hub.getDataValue("localIP")}&port_for_st=${device.hub.getDataValue("localSrvPortTCP")}"
 	
 	if (inactivityseconds?.isInteger())
 	{
 		// Inactivityseconds is both populated and an integer, so lets send it to the Wemos
 		requeststring = requeststring + "&inactivity_seconds=${settings.inactivityseconds}"
 	}
 	
 	// log.debug requeststring
 	// Send the details to SmartThings
 	cmds << getAction(requeststring)
 	return cmds
 }
 
 def refresh()
 {
 	log.debug "refresh()"
 	// SendEvents should be before any getAction, otherwise getAction does nothing
 	sendEvent(name: "ip", value: device.hub.getDataValue("localIP")+"\r\nPort: "+device.hub.getDataValue("localSrvPortTCP"), displayed: false)
 	// Now refresh Alarm status
 	getAction("/refresh")
 	// getAction("/getzonenames")
 }
 
 def installed()
 {
 	log.debug "installed()"
 	//configure()
 }
 
 def updated()
 {
 	log.debug "updated()"
 	configure()
 }
 
 def ping()
 {
 	log.debug "ping()"
 	getAction("/ping")
 }
1 Like

Have you modified the code to comply with Hubitat’s slightly different API to create a child device? The Hubitat version is simpler and is detailed in the first post of this thread.

Yes, with a help from a friend, i changed this:

addChildDevice(“smartthings”, “Motion Detector”, “alarmchildzone${curzone.zoneid}”, device.hub.id, [name: thiszonename])

To this:

addChildDevice(“hubitat”, “Motion Detector”, “alarmchildzone${curzone.zoneid}”, [name: thiszonename])

This is now in the code:

case ["Magnet", "Contact", "Entry/Exit"]:
// If it is a magnetic sensor then add it as a contact sensor
addChildDevice("Hubitat", "Open/Closed Sensor", "alarmchildzone${curzone.zoneid}", [name: thiszonename]) 
log.debug "Created contact zone child device"
						break

case ["Motion", "Interior", "Wired"]:
// If it is a motion or interior sensor then add it as a motion detector device
addChildDevice("hubitat", "Motion Detector", "alarmchildzone${curzone.zoneid}", [name: thiszonename])
log.debug "Created motion zone child device"
break

But I'm getting an error now that says:

Couldnt add device, probably already exists:

com.hubitat.app.exception.UnknownDeviceTypeException: Device type 'Motion Detector' in namespace 'hubitat' not found

Yet, as can be seen from the code above, there is a device type: motion detector, in namespace hubitat?

the ST name space probably has a "Motion Detector" DTH … may be the HE name space does not have a default "Motion Detector" driver?

How would I go about adding one in the HE or the Device Code?

i am speculating … @chuck.schwer is probably the best person to address this.

but if you wanted to try copy the code from ST -> My Device Handlers -> Create New Device Handler -> From Example -> Motion Detector.

with that code create a new driver in HE after making the necessary HE adjustments.

then give it a try?

2 Likes

@bangali is correct there isn’t an out of the box driver called Motion Detector but there is one called Virtual Motion Sensor which should work for you. I use this in one of my apps. So try:

addChildDevice(“hubitat”, “Virtual Motion Sensor”, “alarmchildzone${curzone.zoneid}”, null, [name: thiszonename])

Also noticed a missing parameter in the addChildDevice function call where I am passing null.

1 Like

Yes, that is the one to use.

You might have a look at my Envisalink Integration app. I do similar for contacts and motion, you're trying to do with your integration. Feel free to pilfer if it works for you.

https://community.hubitat.com/t/envisalink-integration-application-and-connection-driver/3123

Hello Mike,
I have the same alarm system bridge. Were you able to get this working?
Thanks

Welcome to the community!

Yes I did get it working. I'll post it shortly. It's not pretty, but it works.

You'll need to go into your Alarm System Bridge and change the IP address to the hubitat, then install the driver, and create a device (using the Alarm System Bridge driver), then set all the IP addresses, passwords etc.

It may take some playing around. I'm loathe to touch mine, as it's working perfectly...faster than ST by a mile.

As I said, code is not pretty, but it works.

Awesome! Thanks Mike. Looking forward to trying this out.

Hello Mike,
Thank you for the driver. I was able to connect to my Alarm System Bridge, get zone names, and create child devices. The connection is working because I can arm my alarm from Hubitat, but the child devices don't register any activity. I am using the virtual motion sensor and virtual contact sensor device types, but have also tried the generic component device types. Do you know what I'm doing wrong?
Thank you

We'd need to know more about your setup, how are you connecting to the bridge, what's the brand? Do you have an API or TPI?

With much help, I implemented the Envisalink Integration app and driver. We needed to parse the payload coming down the telnet pipe and take action on the child devices (contacts and motion sensors).

Have a look and see if it helps you get started.
https://community.hubitat.com/t/envisalink-integration-application-and-connection-driver/3123

Hmm, I'm not sure. Is there anything in the logs?

Is the Alarm system bridge receiving data? So, if you move about the house, go the ASB, and check that it's gettting data.

Thanks everyone,
I am using mike's driver from above. That talks to an alarm system bridge (originally developed for smart things) that communicates to a Networx NX-V2 panel via an NX-584e automation module. The bridge is communicating with the panel, and I am able to connect the bridge to Hubitat with the driver. Hubitat is able to see the state of the alarm (armed/disarmed) and to arm it. It is able to read the device names from the panel and generate child devices. The child devices are all automatically assigned the type virtual motion sensor.

The problem is that the virtual motion sensors that it creates don't work. I checked the logs, and I get this when I activate one of the physical motion sensors.

headers:UE9TVCAvIEhUVFAvMS4xDQpDb25uZWN0aW9uOiBjbG9zZQ0KSG9zdDogMTkyLjE2OC4zLjIxODozOTUwMQ0KU2VydmVyOiBBbGFybSBTeXN0ZW0NCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbjtjaGFyc2V0PVVURi04DQo=, body:

dev:6092019-04-22 11:34:28.361 am debugNot valid json response/message

dev:6092019-04-22 11:34:20.937 am debugmac:4E6574777278, ip:c0a8030f, port:c04f, headers:UE9TVCAvIEhUVFAvMS4xDQpDb25uZWN0aW9uOiBjbG9zZQ0KSG9zdDogMTkyLjE2OC4zLjIxODozOTUwMQ0KU2VydmVyOiBBbGFybSBTeXN0ZW0NCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbjtjaGFyc2V0PVVURi04DQo=, body:

dev:6092019-04-22 11:34:20.930 am debugNot valid json response/message

dev:6092019-04-22 11:34:19.787 am debugmac:4E6574777278, ip:c0a8030f, port:c04e, headers:UE9TVCAvIEhUVFAvMS4xDQpDb25uZWN0aW9uOiBjbG9zZQ0KSG9zdDogMTkyLjE2OC4zLjIxODozOTUwMQ0KU2VydmVyOiBBbGFybSBTeXN0ZW0NCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbjtjaGFyc2V0PVVURi04DQo=, body:

dev:6092019-04-22 11:34:19.781 am debugNot valid json response/message

dev:6092019-04-22 11:34:19.230 am debugmac:4E6574777278, ip:c0a8030f, port:c04d, headers:UE9TVCAvIEhUVFAvMS4xDQpDb25uZWN0aW9uOiBjbG9zZQ0KSG9zdDogMTkyLjE2OC4zLjIxODozOTUwMQ0KU2VydmVyOiBBbGFybSBTeXN0ZW0NCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbjtjaGFyc2V0PVVURi04DQo=, body:

dev:6092019-04-22 11:34:19.224 am debugNot valid json response/message

dev:6092019-04-22 11:34:14.631 am debugmac:4E6574777278, ip:c0a8030f, port:c04c, headers:UE9TVCAvIEhUVFAvMS4xDQpDb25uZWN0aW9uOiBjbG9zZQ0KSG9zdDogMTkyLjE2OC4zLjIxODozOTUwMQ0KU2VydmVyOiBBbGFybSBTeXN0ZW0NCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbjtjaGFyc2V0PVVURi04DQo=, body:

dev:6092019-04-22 11:34:14.625 am debugNot valid json response/message

dev:6092019-04-22 11:34:04.926 am debugmac:4E6574777278, ip:c0a8030f, port:c04b, headers:UE9TVCAvIEhUVFAvMS4xDQpDb25uZWN0aW9uOiBjbG9zZQ0KSG9zdDogMTkyLjE2OC4zLjIxODozOTUwMQ0KU2VydmVyOiBBbGFybSBTeXN0ZW0NCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbjtjaGFyc2V0PVVURi04DQo=, body:

dev:6092019-04-22 11:34:04.920 am debugNot valid json response/message

dev:6092019-04-22 11:33:50.185 am debugmac:4E6574777278, ip:c0a8030f, port:c04a, headers:UE9TVCAvIEhUVFAvMS4xDQpDb25uZWN0aW9uOiBjbG9zZQ0KSG9zdDogMTkyLjE2OC4zLjIxODozOTUwMQ0KU2VydmVyOiBBbGFybSBTeXN0ZW0NCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24vanNvbjtjaGFyc2V0PVVURi04DQo=, body:

dev:6092019-04-22 11:33:50.180 am debugNot valid json response/message

Thanks everyone

Did you get this working. Recently I moved my Alarm system bridge to a second HE hub, to get it off my main HE hub, and I got it working very quickly. I've changed a few things as well in the current driver to remove 99% of the chatty logs. It should help speed up your single hub remarkably. Let me know if you need any help.

Also, if you check the smartthings thread, there is an update for the ASB firmware (by the author), that also helps deal with some of the chattiness of the logs (especially for the way Aussie installers tend to setup the system).

Both these have helped reduce the number of logs for the ASB from tens of thousands per day, down to ~1,000 per day for my use case scenario.

Hello Mike,
I had given up on getting this to work. I got your driver to partially work, but it never responded to my motion or contact sensors. I will try the updated asb firmware from the smart things thread. Would you mind sharing your updated hubitat driver with me?
Thanks
John

Sure,

It's here: ASB/Driver at master · GeorgeCastanza/ASB · GitHub