Virtual Contact Sensor does not open/close from Dashboard click

I just added a virtual contact sensor, a virtual switch, and a virtual lock to a dashboard to help debug a new rule. The virtual switch goes on and off with a click to the dashboard, as does the virtual lock. But, the virtual contact sensor is not responsive to a click on the dashboard. Is this a bug, or am I missing something?

1 Like

Fairly certain this is normal operation. A dashboard tile representing a contact sensor (virtual or otherwise) simply displays data. It will not open/close the contact.

If you think about this it makes sense, as a virtual sensor is meant to mimic the real thing. A dashboard tile representing an actual switch can turn that switch on/off. A dashboard tile representing an actual lock can lock/unlock the actual lock. But a dashboard tile representing one of my actual contact sensors cannot open or close the window/door.

2 Likes

I may be wrong but I don't believe you could control the Sensor by the Dashboard click, since its supposed to only indicate the status (open/close)

1 Like

On the other hand, in support of the OP, RM5 can and does allow the user to "Close" a virtual contact sensor as needed. Some of us use this "feature" as a means of triggering a Routine on Alexa (Amazon Echo), since contacts are among the few device types she will honor to initiate Routines.

Perhaps a suitable workaround in Dashboard, if it cannot have the necessary native ability that the OP is requesting, would be to create yet another virtual switch along with a Rule in RM5 designed to do the "Close" or "Open" actions in response to the VS turning ON or OFF.

(Seems like a lot of effort, though...)

You could also just use a custom virtual contact sensor driver that also exposes the switch capability (on() and off() commands). For Alexa, use the contact capabilities (all you really can do); for Dashboard, use the switch commands/attributes/template. Here's one option: https://raw.githubusercontent.com/stephack/Hubitat/master/drivers/Virtual%20Contact%20Sensor%20with%20Switch.groovy

It doesn't have an "auto-off" (or "auto-close") feature, but it would be easy to add if anyone really needs it, otherwise toggling it on the Dashboard would change the state.

1 Like

Thanks for the feedback/comments. For my testing purposes, I can probably just use a virtual switch to indicate the open/closed state of a sensor in my rule. Just thought, since it was a virtual contact sensor, that it would work in the Dashboard much like the switch. But, now I understand that a contact sensor is traditionally a passive device vs. a switch or lock that is more active. Thanks all -- what a great support group! Will get to work on the rule now. Merry Christmas.

1 Like