General DTH Question - Device-level behaviors

@krlaframboise @JDRoberts Hi. I’ve got a general Custom DTH question that is driven by my experience today with Kevin’s Aeotec NanoMote scene controller.

Must all devices using a custom DTH have exactly the same behavior? For example, if I apply a custom DTH to a device type (say, a button controller) and then specify Button #1 does X and Button #2 does Y, then will every device using that DTH have the exact same behavior for Button 1 and Button 2?

Or can I use the DTH and then specify different behaviors/actions on different physical devices?
• Device 1 - Button #1 does X and Button #2 does Y
• Device 2 - Button #2 does A and Button #2 does B

I want to be able to have different behaviors at the physical device level. Does that require using DTH #1 for Device 1 and a cloned DTH #2 for Device 2?

Thanks. I hope that is clear.

All that the DTH does is create events for physical actions.

What “Button #1 does and Button #2 does” should be determined by a SmartApp, not the handler.

2 Likes

The commonality definition and requirements are defined in the Capability Definitions (available on the web). These drive common behavior in DHs/Devices at the command and attribute level. For example, volume is defined as 0 to 100. My devices are 0 to 30 or 0 to 60. So my DH has to modify the scale on input from the interface/rule applications and on the reported attributes.

There are no other definitions to drive commonality between handlers.

1 Like

That’s what I thought, too, but the experience yesterday doesn’t follow that. The brand new Device #2 started up with the same button configuration as the already-configured Button #1.

Thanks. So why does the brand new Device #2 start up with the same configuration for Button #1 that was specified on the previous Device #1?

Thanks, Dave. So, if I do not want common behavior between devices, then it sounds like I need to create a unique derivative DTH for each device I want to have different behavior. Is that correct?

If you want a different behavior than the default for a device, there are two options:

a. Use the device preferences to identify that the particular device needs a different behavior, then adjust the code to accommodate,
b. Write a separate, independent device handler.

Example: Volume (normal behavior is 0 to 100. You can define in preferences the devices explicit scale (i.e., 0 to 60 or 0 to 80) and then

  • in the method level, calculate the value you want sent to the device
  • in the parse method, reverse the value so the level you report back to external apps is consistent.

Not sure if this is where you are going

The behavior features in the DTH are good as written by Kevin. I just need to have different buttons do different things on different devices using the same DTH.

I learned today that you can install the same SmartApp multiple times and assign each installed app to a different physical device. I did that with with my three different Aeotec NanoMotes and it worked perfectly.

I didn’t know you could install a SmartApp more than once and that was the solution to this problem.

2 Likes