[OBSOLETE] Universal Virtual Device Type and Translator

This has got to be the sickest DTH ever…
The uDTH

Ever wished you could turn on a presence sensor with a switch?, or maybe take a lock command and send a motion event?

Basically this bad boy accepts these commands:

  • on
  • off
  • open
  • close
  • lock
  • unlock

and can turn them into these attribute states:

  • open
  • closed
  • present
  • not present
  • active
  • inactive

The following capabilities are presented on the command side:

  • switch
  • door control
  • garage door control
  • lock

The following devices are presented on the attribute side:

  • Contact
  • Motion
  • Presence
  • Door
  • Acceleration
  • Illuminance
  • Smoke
  • Water
  • Sound

You wire up an instance of this device to two separate apps, and off you go.

Add to your repo, and select the device MikeMaxwell : uDTH
the repo is
owner: MikeMaxwell
name: dth




For those without git integration:
https://github.com/MikeMaxwell/dth/blob/master/devicetypes/mikemaxwell/udth.src/udth.groovy

Version updates:
uDTH 1.0.3 2016-05-18 added optional auto off
uDTH 1.0.4 2016-05-21 added LUX capability
uDTH 1.0.5 2016-08-29 added sensor and actuator capabilities
uDTH 1.0.7 2016-09-22

  • added smoke, water and sound thanks Scott!
  • added not used option to each device tile
  • fixed bug in illuminance not working
39 Likes

I’ve wanted to make this forever. I have contact sensors I want to act like motions… (they all should be by default IMO). If a door options, that’s motion!

Thanks for this!

1 Like

so you’re saying that setting this up will allow an opening door (contact sensor) to be seen as a motion action?

1 Like

Ok, I’m missing something. How do I wire it to my devices?

It accepts actuator inputs as these are commands. A device type can’t subscribe to other device events.
So this is more of a glue device to be used between two apps that don’t share a common device type.

1 Like

Ok… It’s a been a stupid long day for me…

example please?

1 Like

You could take the code and add it to a real device handler.
I can do this if there is interest with specific device types.
Converting an existing device type would be much easier that creating this one.
Just let me know which devices your interested in.

Take shm, the security section only accepts contact and motion sensors.
You could use another app to turn on this dth, and send a contact or motion event to shm.
You could use smart lighting to turn on this dth, then sent another type of event to any other app.
That type of thing.
It’s a virtual sensor who’s output is controlled by typical binary actuator commands.

4 Likes

Mike this is tooo cool, perfect for virtual presence and garage doors…Awesome, awesome work!

1 Like

Mike, can you add to every action if it’s already on, don’t turn it on, or if it’s off don’t turn it off? Or do you think I should do that via a custom app? I’d like to use Smart Lighting, but I notice that for motion, for example it fires the switch on constantly.

So for the inputs (on/off ect), do not send the output events unless the input state has changed?
If that’s the case, yea, let me know.

@SBDOBRESCU, I just pushed a patch for this, dorrrrr… this was the “intended” function all along.

1 Like

This is awesome! I see many uses for this… Thank you!

May I make a feature request for all those who connected their hard wired smoke alarms to open/close sensors and can’t use them in SHM? Capability for command “Smoke Detector”, attribute “alarmState”. (Hope I got this right and it is not more complicated than this…)

1 Like

Thanks Mike, couple more things. First would you be able to add versioning. Ive updated the device, but it still fires with every motion event see pic. Also, would it be possible to turn off the capabilities that are not used/enabled? I set one for garage control and it shows in the ‘Family’ section. This is esthetic more than functionality, really so no big deal if not possible.

alarm could be an input since it has commands (strobe, siren etc)
however contact only has attributes (open, close)
a device can read the attributes of another device (probably not intended), but it can’t subscribe to any device attribute changes like a smart app.
Now having said that, this DTH could in fact do this, but would require something to poll it, when the device is polled, it would then have a look at the contact sensor state, and then set the alarm attribute.

This isn’t ideal obviously, and the ability of one device to retrieve attributes from another device that’s been selected in the preferences section I believe is something of an unintended “feature”, that I’m guessing ST will prevent in the future.

The device capabilities that the device presents can’t be modified programmatically.
I can ignore any commands, but there’s no way to change them after the device is published.
The only way to remove them is to comment them out.

Can you tell me what you’ve got configured there?
is that a switch to motion converter?

I have the specific setup that you do, I hacked the contact DTH specifically to make it act like a smoke/CO device.
Depending on the contact that you have, these DTH’s may work for you too.
Let me know which DTH your contact sensors are currently using.

I love it. Turning what the security researchers call a risk, into a killer feature. Nice job Mike! This is awesome.

5 Likes

I use an old Schlage Sensor RS100HC V N N SL and a slightly modified a “z wave Door/Window Sensor” DTH. It has contact sensor, sensor, and battery capabilities (even though the Schlage sensor does not support battery)