Multiple input devices

triggers

#1

Is it possible to create a DH that allows multiple input devices to act separately? ie a temperature sensor and 2 contact sensors in one device.

It is slightly related to WebCoRE because I want to use in my pistons. I have a binary input device and one of the DH is temperature, contact, motion and webCoRE picks these up as 3 different possible inputs. But I have another DH that is dual contact and temperature and i wanted to make webCoRE see these as 2 contacts rather than one. At the moment I have to create 2 separate virtual contact sensors and link them to the device with app, i’m hoping i could do away with this if i can just get the DH right.

Is this even possible for WebCoRE to identify the 2 contacts and temperature sensor on one device as 2 different inputs @ady624, when you select the device in the settings? Thanks


#2

If you expose them as two different contacts, sure. And while declaring the attributes, make sure you declare them as enums and provide the possible values [‘open’, ‘closed’] so that webCoRE can offer you those options


#3

Brilliant news.

Sorry should have stated that i’m a complete novice at code, i’m currently starting a online course to learn javascript so i can eventually learn groovy (think that’s the right way :thinking:). But I am logical enough to find a few DH, put them together and tweak to make them do what i want them too, even if its a bit messy, which is what I did for this case. So they have got values in as ‘open’, ‘closed’ they are also labeled/ referenced as contact1 and contact2. The DH seems to work fine but can’t seem to get them to come up like that on webCoRE.


#4

If you just modified the DTH, you may have to go to webCoRE’s settings in the ST app and revisit the Available Devices so that webCoRE rebuilds the device cache.


#5

Thanks, i just tried that but its still only coming up with one contact :frowning_face:. I think its something in the DH, that even though they are down as 2 contacts there not fully down a 2 contacts because I have missed something :confused:.

is it something to do with that there is only one of these?

def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd) {
log.debug "BasicSet V1 ${cmd.inspect()}"
if (cmd.value) {
createEvent(name: “contact1”, value: “open”, descriptionText: “$device.displayName is open”)
} else {
createEvent(name: “contact1”, value: “closed”, descriptionText: “$device.displayName is closed”)

should there not be another one for contact 2?


#6

You need them defined in the meta, where the capabilities are defined.


#7

Thank @ady624 This is what I have below at the moment.

capability "Contact Sensor"
capability "Temperature Measurement"
capability "Configuration"
capability “Sensor”

I tried adding another contact sensor and naming it contact sensor 1 and the 2 yesterday but that wouldn’t let me. I have also just tried having two “contact sensor” that let me do it, but it didn’t work either. What is the correct way to define 2 or more?


#8

Under the last capability add

attribute “contact2”, “enum”, [“open”, “closed”]

I am not sure that is how you declare an enum though, check with documentation or other developers please


#9

Thanks, I’ve ask the question on the ST forum but not got anything yet. Thanks for your help so far.