Device Selector Input (Preference) in Device Driver

I think I already know the answer from testing but it appears that a device selector e.g. "capability.speechSynthesis" only works in an app's preference. This does not work in a device driver's inputs, correct?

No. The capabilities are mainly for device drivers. For a list of capabilities see:
https://docs.hubitat.com/index.php?title=Driver_Capability_List

In a driver, each capability defines command and attributes.

You super missed the point I think. I know that capabilities are for drivers. I want to have an input in a driver to select another device by capability. That functionality exists in apps. It does not appear to exist in devices. I just want to confirm this to be the case.

Correct, I did miss point. Sorry. You are probably correct.

1 Like

For example, this works:

definition(
	name: "Test App Name",
	namespace: "a-namespace",
	author: "An author's name",
	description: "Test app description",
	category: "Nonsense",
	iconUrl: "",
	iconX2Url: ""
)
 
preferences {
  section("Settings") {
    input "aVariable", "capability.speechSynthesis", required: true, title: "TTS Device?"
  }
}

But doing the same thing with that type of input in a device does not work.

probably will not work. No interface in device drivers like apps to do the actual selection. What exactly are you trying to accomplish? There may be another way.

There is another way. I need to trigger something in Hubitat from IFTTT's webhook functionality.

  • Option 1: Enable the Maker API and have IFTTT use Webhooks to send a command directly to a device.

  • Option 2: Enable OAUTH in an app, create a token and have IFTTT use Webhooks to send a command to an app.

The only problem with option 1 is that once I get the command and payload I want to turn around and TTS it to a speech device. The speech device I wanted to use was the would-be input.

I'll do it with an app.

@codahq:
Yes, there is no way to dynamically set capabilities in drivers at this time. @chuck.schwer confirmed it for us over in this thread:

I believe what @codahq wants to do is communicate from one device to another (not dynamically change the capability of the device itself).

I asked a similar question a while back. The answer I received was that device to device communication was not allowed (security issue of some type). The only exception would be with a parent/child device structure i.e. a driver with component devices. Otherwise, an app would be required to handle the communication between devices.

2 Likes

Why not simply expose the "speechSynthesis" device via the Maker API and cut out the middle man?

Because it's not the speech synthesis part that is the problem. The problem is I can't give the user an input on a driver where they can pick the target in an input based on capability.

I've gone ahead and done it in an app. Apps appear to be the only place where inputs work when using capabilities.

Thanks for the responses everyone.

1 Like