Help with input Device Input type

(Steve S) #1

I wrote my own “Thing” with an Arduino and a ThingShield - It’s a garage door controller for my two-door garage and it works perfectly. I now want to subscribe to events from my Thing so i can take actions based on them. My device type handler i wrote is named “Garage”. According to the support “documentation” here, I should be able to specify device.<device type name> to pick my device type in an app like so:

input "theGarage", "device.Garage", title: "Pick the garage", required: true

specifically, the documentation says:

The device type name can be one of the standard device types or the name of a device handler you have created.

However, I cannot get this to work. I have tried using the name of my device type “Garage” and the name of the installed instance of that device type “MyGarage” - no joy either way. I can “trick” the system by checking off one of the capability boxes in the device type and then using capability.<capability I don’t actually support> to be able to actually pick it in my app.

So, how does one go about subscribing to events from a custom device type that doesn’t supply one of the standard capabilities?

(Jonathan) #2

Did you make any progress with this? I’m now facing exactly the same problem…

Cheers, Jonathan

(Brian Steere) #3

I’m not sure about using the device name, but can you create custom capabilities that you do actually support (open/close maybe)? And then watch for that capability.

(Steve S) #4

@badgermanus - yep. I contacted support and they helped. It turns out you can use device.<Device Type Name>, but the trick is that you have to “Camel Case” your device type name

So if you have a a device type called “My Great DeviceType”, in your code you would use “device.myGreatDevicetype”

So you lowercase the the first word, then only the first letter of each word is capitalized (where word is defined by groups of consecutive non-whitespace).

My device Type is called “GarageDoor” and in my code I can use this to be able to pick it:

input "theGarage", "device.garagedoor", title: "Pick the garage", required: true

(Lord Saibat) #5

Did you post your code any where? I am trying to subscribe to another device using “subscribe(Input_Monitor, “IM”, IMHandler)”

But I keep getting null on Input_Monitor