I am trying to determine whether an event came from a physical device and, if so, to run a block of code. The only method that seems close is the event.isPhysical() method, but that only determines if an event was triggered by physically actuating something. Is there any way to determine whether an event came from, for example, a real contact sensor vs a virtual contact sensor?
Why do you want / need to determine this?
A major key element of SmartThings’s architecture is that as long as a SmartDevice fulfills the Contract implied by the list of Capabilities it claims, then every device, physical, virtual, or ethereal, is should be considered equivalent by all SmartApps and external services).
All Devices with the same claimed Capabilities are supposed to be 100% interchangeable.
Virtual Devices may implement important abstraction layer logic on top of one or more physical devices. The net implication to the SmartApp is support to be irrelevant – at least that’s my understanding of the purpose abstraction.
But I’m definitely interested in your question…