DEVELOPERS, please can you write a virtual device sync smartapp? PLEASE!

So I’ve given this a couple cracks and I’ve struck out without even seeing the ball. I have no clue how to write this and I’m hoping someone has the experience and time to help out.
I think this will help a lot more than just me, and would be a companion app to a DTH.

The DTH is a multifunction handler. It is for a GoControl z-wave door/window sensor.
The dev @krlaframboise has written an awesome handler. The GoControl sensor has both an external reed contact (default) and internal terminals for a 2nd connection. Kevin incorporated both into the handler so it’s like having 2 sensors in one. Also, he has made it with user selectable attributes to each contact, for users who have alternative uses. Such as wired to smoke alarm relay, or a driveway type motion detector’s dry contacts. Or to show as a water sensor or garage door. It’s a fantastic piece of work!

The one drawback is that the secondary function shows up within the device tile page. And outside services like stringify can not see the secondary contact like native ST can.
So I suggested adding functionality to the DTH that allows syncing the 2nd contact’s attribute to a virtual device. But apparently that requires a smartapp, and while a couple of users have suggested resources to learn from, I can’t really make much of a head from a tail.

So I reach out here.Is there anyone who might have the time or want to take on writing a virtual device mirroring smartapp for this handler. It would be the perfect companion and I’m pretty sure Kevin would link in his main post to it.

All the app would do:
Select sensor
select contact 1 or 2
select (current) contact attribute
(either create and assign, or have user create virtual device in IDE) then assign current contact attribute value to virtual sensor

Also, while it is not part of the GoControl multifunction handler, it’d be awesome if it could assign temperature value to a virtual sensor from a device that has temperature as a secondary function, (ie Iris Button, Iris Keypad, Zwave motion sensors, xiaomi temperature sensor, etc).

This would be a simple value mirroring assignment. Just need a guru to take on the gig.
Is there anyone who is up to it? :slight_smile:

Here’s a link to the GoControl Multifunction handler thread by Kevin.

I thought of Eric last week, but he is a bit busy as of late and I didn’t want to bug him again. He was one of the guys who gave me some roadmap info on how to do it.

@anon36505037
So the Fibaro smartapp in concept is exactly the base of what I’m looking for.
What I don’t know how to do is modift it so as to have it:
point physical device contact-internal to “switch 1”
point physical device contact-external to “switch 2”

and then based on the attribute selected in the gocontrol multifunction DTH sync that specific attribute type rather than just contact open/closed to the virtual device

Basically the attribute sync should be of the gocontrol DTH output value not input value:
See below. I diagramed it to make it easier to picture:

To make the smartapp less device specific and more generic it could also have the ability to do the same to the internal contact so as not to have the smartapp only limited to a specific physical capability instead of all device capabilities

I moved your post to the developer’s category on writing smartapps. It’s possible you’ll get more views and then suggestions from people who watch this category. I’m not a developer so I can’t help anymore than that, good luck though.

1 Like

@ogiewon has written several mutiplexor apps that take multiple inputs from the Arduino and map them to virtual devices.

1 Like

The device handler was written specifically to avoid having to create a custom SmartApp to sync it with a virtual device.

There are a lot of steps below, but I broke the CoRE part down into step-by-step instructions because it sounds like you’re unfamiliar with it.

Create Virtual Device

  1. Go into the devices section of the IDE and Add a new device.

  2. Choose “Simuated Contact Sensor” as the type.

Contact Sensor Settings

  • Primary Status Attribute: internalContact

  • Motion Active Event: externalContact.open

  • Motion Inactive Event: default

  • Main Contact Behavior: Internal Contact Only

CoRE Piston Setup

  1. Tap “Add a CoRE Piston”

  2. Change Piston Mode to “Simple”

  3. Tap “If…” and then tap “Add a condition”

  4. Tap “Capability”, choose “MOTION SENSOR” and then select the GoControl Contact Sensor.

  5. Tap “comparison”, select “Changes to”, tap “Value”, select “active”, and then tap “Done” twice to get back to the main If,then, else screen.

  6. Tap “Then…”, tap “Add an action”, tap “Control any device”, (which is at the very bottom of the list), tap “contact sensors”, select the new device you created, and then tap “Done” twice to get back to the main If,then, else screen.

  7. Scroll to the top of the screen, tap “Add a task”, choose “Open”, and tap “Done” twice.(you should be on the if… then… else… screen at this point.)

  8. Tap “Else…”, and repeat steps 7 and 8, but this time choose “Close” instead of “Open” and tap “Done” until the smartapp closes.

Now you should have the original contact sensor that reports open and close when the magnet is used and a virtual contact sensor that reports open and closed when the external sensor opens and closes.

The temperature aspect can’t be done without modifying a device handler.

3 Likes

Kevin, thanks! Wow, really thank you for the detailed write Up!

Were you able to get it working?

I will try tomorrow. I’m out of town at the moment. Work.
Really appreciate the follow up! I’ll report back as soon as I can.

Shortly after posting that, SmartThings announced that device handlers can now have child devices so CoRE is no longer necessary.

The “Multifunction” version of my GoControl DTH is meant to support everything so I left that one as-is and built the child device feature into my original GoControl Contact Sensor DTH.

You should install that DTH and the child DTH listed below it. Then switch your device to the new handler and change the “Main Contact Behavior” setting to “Internal Contact Only” and enable the “Create Device for External Sensor?” setting.

That should make a new device appear in your Things list that is synced with the External Sensor. You should open the settings screen and save so that all the default settings get applied and you might have to trigger the external sensor to make it sync the first time.

Have a look at the device handler that I wrote, I thinkit does exactly what you want. Basically you choose what devices you want to subscribe to and it passes events from one device to the other so that they stay in sync.