metadata { definition (name: "Simulated Motion Sensor and Switch", namespace: "Simulated Motion Sensor and Switch", author: "Ian Boje", cstHandler: true) { capability "Motion Sensor" capability "Switch" } simulator { // TODO: define status and reply messages here } tiles { // TODO: define your main and details tiles here } } // parse events into attributes def parse(String description) { log.debug "Parsing '${description}'" // TODO: handle 'contact' attribute // TODO: handle 'switch' attribute } // handle commands //def on() { // log.debug "Executing 'on'" // TODO: handle 'on' command //} //def off() { // log.debug "Executing 'off'" // TODO: handle 'off' command //} def on() { log.debug "Turning Switch and Sensor On" sendEvent(name: "switch", value: "on", isStateChange: true, display: true, displayed: true) sendEvent(name: "motion", value: "active", isStateChange: true, display: true, displayed: true) } def off() { log.debug "Turning Switch and Sensor Off" sendEvent(name: "switch", value: "off", isStateChange: true, display: true, displayed: true) sendEvent(name: "motion", value: "inactive", isStateChange: true, display: true, displayed: true) }