//Create a class for momentory switch device package Momentary import SmartThing.SmartThing public class Momentary extends SmartThing { // id, label, and display name of the device String id String label String displayName Momentary(Closure sendEvent, String id, String label, String displayName) { idSmartThing = id labelSmartThing = label displayNameSmartThing = displayName sendEventSmartThings = sendEvent // Initialization this.id = id this.label = label this.displayName = displayName } // Methods to set values def push() { setValue([name: "momentary", value: "pushed", deviceId: id, descriptionText: "", displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}']) } }