The way I understand the platform is as follows. The capabilities of a device defines what commands and events the device will support. It also makes that device show up in SmartApps when they look for capability=xyz. So defining the smoke detector capability will make it show up in the Damage & Danger section SmartApps. If you then install the SmartApp, it will subscribe to the smoke detector events. But if your actual device never emits those events, the SmartApp event handlers will never be triggered. So therefor your device type must also emit those events.
I posted a link above to my device type. The main change I made, was to emit smoke detected and cleared events instead of open / closed events. This seems to work perfectly with the existing D&D SmartApps.
I also removed the contact sensor capability and added the smoke detector capability. The code below (from the device type) essentially intercepts the open / close events and emits the expected smoke events to make the internal SmartApps fire correctly.
private Map getContactResult(value) {
log.debug 'Contact Status'
def val=""
def descriptionText=""
if (value == "open")
{
val = "detected"
descriptionText = "$device.displayName detected smoke"
}
else if (value == "closed")
{
val = "clear"
descriptionText = "$device.displayName smoke is cleared"
}
return [
name: 'smoke',
value: val,
descriptionText: descriptionText
]
}