[RELEASE] Universal Virtual Device Type and Translator

Sorry if this was asked and I missed it:

I’ve added a virtual device to SmartThings and the Amazon Alexa app recognizes it as lock, but Alexa shows gets error when it tries to get status both in the app and via voice command.

Also, devices tied to the device handler show up on the SmartThings home screen under Home Solutions -> Smart Locks as always unlocked.

Is it possible to get Alexa to get the lock status?

Thanks for the device handler.

FYI, I have a work around for Alexa and here is the case I’m using:

I was able to get a single door status in Alexa by just using a Simulated Lock virtual device and the Enhanced Auto Lock Door automation tied to a single door sensor. This works well and Alexa can tell me if the door or window is locked (really closed) or unlocked (open).

I wanted a single “Lock” to check if all the doors/windows are closed, but the auto lock door routine only takes 1 sensor and while other automation functions like the Smart Lighting can take multiple sensors they only turn a switch on/off and not toggle the state of a sensor. This device handler is a good bridge because it accepts the switch commands as inputs and reports out a sensor status.

With this device handler I created a virtual device “AD” (all doors).
Then I added a “Smart Lighting” automation so that if any of the doors is opened (door sensors), then “AD” is switched to open/on/unlocked. When a door is closed, the routine closes “AD”.
Alexa can see the device but it doesn’t see the status right.
The work around is to add another virtual device (a Simulated Lock) and the automation “Enhanced Auto Lock Door”. The automation takes a contact sensor (which can be “AD”) and changes the status on the Simulated Lock. If Alexa sees the correct status from AD, I could junk the extra simulated lock.

Also, I need to find or write a different automation routine to combine multiple sensors into 1 state. The desired state is to shows open if ANY of the doors is open and closed only if ALL of the doors are closed.
Right now if I open 2 doors an close 1 “All Doors” shows closed, which isn’t desired.

Based on a previous answer Mike provided I was able to find a solution:

find this line in the code: sendEvent(name: “uDTH”, value: “on” ,displayed: false)
add this line under it: sendEvent(name: “lock”, value: “unlocked”, displayed: false)
then find this line in the code: sendEvent(name: “uDTH”, value: “off” ,displayed: false)
add this under it: sendEvent(name: “lock”, value: “locked”, displayed: false)

I’m trying to figure this out. I want to make a door switch a motion sensor to trigger a light. Reason being is that if it is registered as a motion detector I can have it shut off after x amount of minutes which isn’t easy as a regular door sensor

Do you mean you want a light to turn on in response to a door opening (or closing), and then wait x minutes before the light turns off?

There are better ways to do that.

yes, that is what I am trying to do. I want it so the light triggers on with a door opening and then turns off x amount of minutes later regardless of the door opening or closing again.

This wiki post explains how to do it with a virtual switch as the off timer.

http://thingsthataresmart.wiki/index.php?title=How_to_create_a_virtual_timer_for_a_light

And this post covers pretty much anything else related to creating automations. This could be done easily with WebCoRE, for example.

Somebody posted that and I did look at that page. However, it lists an older version of the smartthings app, before my time with ST, and in that app there is a power allowance option to set the minutes. The newer version does not have this feature that I could find.

Power allowance was not removed from smart lighting. When you create the automation and set it to turn a switch off, power allowance is one of the options for triggering the switch to turn off.

I took this screenshot just now.

1 Like

This has to be the best mod for SmartThings!!

I just did the undoable. I am using my Yi home camera mounted outdoors to trigger a virtual motion sensor that is turning on my porch light.

Mind blown!!!

3 Likes

How can I prevent my uDTH devices from showing up as locks? I’ve got the lock part of the settings turned off plus everything else that I’m not using them for but still show up in my locks.

I’m having the same issue and looking for a solution as well. Other than that, this DTH is great!

You can’t dynamically change device capabilities, you can however comment out that line in the driver.

I wouldn’t know where to begin editing the handler.

I did what Mike said a long time ago. I have various versions all for specific tasks with unused stuff commented out. Can’t recall the exact line but it’s near the top, capabilities, then one other spot iirc.

To comment just add // in front of the line? I see where it says capabilities but what does iirc mean when you one other spot?

Never mind commenting out the lock capability did the trick. Thanks!

Got rid of the references in lock page but still showing something. Not sure if I can fix that or no - nothing major anyway.

Thank you for sharing this uDTH! I’ve created a Virtual Switch and I’m trying to use IFTTT to trigger this switch whenever my phone connects to my home network. For some reason, it’s not turning the Virtual Switch on when connected. For the IFTTT recipe, I’m using:
IF
Android Device > Connects to a specific WiFi network > My Network Name

THAT
Smartthings > Switch On > Virtual Switch

I’ve already authorized IFTTT to control the switch through ST IDE. Any ideas why it’s not triggering?

Pretty new to STs here. I got uDTH to show up under “My Device Handlers” from github on the ST IDE, but when going to my ST mobile app “Marketplace” > “SmartApps” tab > “My Apps” I cannot find uDTH. Any help is appreciated!

Note: On the ST IDE, uDTH is showing up as blue under “My Device Handlers” and doesn’t show up under “My SmartApps”

Nevermind, found the solution. I was missing the steps from Post # 78 [RELEASE] Universal Virtual Device Type and Translator