public class Momentary extends SmartThing {
// id, label, and display name of the device
- StringBuilder id = new StringBuilder()
- StringBuilder label = new StringBuilder()
- StringBuilder displayName = new StringBuilder()
+ String id
+ String label
+ String displayName
- Momentary(Closure sendEvent, StringBuilder id, StringBuilder label, StringBuilder displayName) {
+ Momentary(Closure sendEvent, String id, String label, String displayName) {
idSmartThing = id
labelSmartThing = label
displayNameSmartThing = displayName
// Methods to set values
def push() {
- println("the momentary switch with id:$id is pushed!")
- sendEvent([name: "momentary", value: "pushed", deviceId: id, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
+ setValue([name: "momentary", value: "pushed", deviceId: id, descriptionText: "",
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
}
}