Device-Specific Inputs?

Do device-specific inputs work in Groovy in Hubitat?

In SmartThings, you could do this in the preferences for an app:
input "myDevice", "device.myFancyDevice"
and it would filter the selection list to only include devices that used the "My Fancy Device" driver.
https://docs.smartthings.com/en/latest/smartapp-developers-guide/preferences-and-settings.html#device-specific-inputs

I've tried it in Hubitat and it compiles and runs without error, but the device list is always empty. Does this work? Am I doing it incorrectly?

The same should work in Hubitat. Do you happen to have a typo or a misplaced upper/lowercase letter somewhere compared to the (modified as documented) name of the driver you're looking for?

Hmm, I thought I had done it right, but maybe y'all can help me spot my mistake. Here's the metadata for the driver:

metadata {
    definition (name: "Person Status", namespace: "mikee385", author: "Michael Pierce", importUrl: "https://raw.githubusercontent.com/mikee385/hubitat-mikee385/master/drivers/person-status.groovy") {
        capability "Actuator"
        capability "Presence Sensor"
        capability "Sensor"
        capability "Sleep Sensor"

        attribute "state", "enum", ["home", "away", "sleep"]
	
        command "awake"
        command "asleep"
        command "arrived"
        command "departed"
    }
}

And then here's the input from the app:

input "test", "device.personStatus", title: "Test", multiple: false, required: true

I've confirmed that I have 2 of these devices created:

But within the app, the select list is empty:

It might be simpler to use the “Sleep Sensor” capability as your filter. I have never seen the use of a specific device name as a filter. Learn something new every day! @chuck.schwer would know for sure whether or not Hubitat supports that functionality.

I think I've figured it out. Unlike SmartThings, the device name should be capitalized:

input "test", "device.PersonStatus", title: "Test", multiple: false, required: true
3 Likes

Thanks for sharing the solution. This is an interesting feature that I never knew about.

2 Likes

The match is done by removing the spaces in the name, so if you named your driver "person Status" it would be "device.personStatus" or if you named it "PERSON status" it would be "device.PERSONstatus"

5 Likes

I'm running into an issue where I can't filter on "HomeSeer WD-200 Dimmer".

What would the "device.xxx" be here? Reading the SmartThings docs it seems like it's impossible the way it starts with HomeSeer since "HomeSeer" -> "Home Seer"?

I'm also trying to do this, but having no luck.

My App config page has this section:
section
{
input name: "managedSwitches", "device.InovelliDimmerRedSeriesLZW31-SN", title: "Output Switches", multiple: true, required: true
}

Driver name is: "Inovelli Dimmer Red Series LZW31-SN"

Error is
Error: No signature of method: user_app_test_MyApp.input() is applicable for argument types: (java.util.LinkedHashMap, java.lang.String) values: [[name:managedSwitches, title:Output Switches, multiple:false, ...], ...] Possible solutions: inspect(), wait(), run(), run(), any(), find()

I've tried a few combos of removing spaces, removing the dash, etc, and I get the same error. Anyone know what I'm missing?

HAHA, I posted this after a few hours of hitting my head against the wall, and sure enough in 5 minutes after posting, I stumbled upon the missing bit. Forgot to put type: in front of the device name! Replying here in case it helps any future traveler.

        section
        {
            input name:	"managedSwitches2", type:"device.InovelliDimmerRedSeriesLZW31-SN", title: "Output Switches", multiple: true, required: true            
        }
1 Like

Is this a simple string match or are wildcards/regexes allowed?

I'm asking because I have separate drivers for various LIFX devices, all of which start with the string 'LIFX', so a device name of 'LIFX*' would be very handy.

FYI - Chuck no longer works for Hubitat.

Ah, that's a bugger. Hadn't realised that.

Wildcards definitely don't work - would be nice if they did.

Download the Hubitat app