import Timer.SimulatedTimer
public class Switch {
- private int id
+ private String id
private String label
private String displayName
private String switchState
def timers
- Switch(Closure sendEvent, int id, String label, String displayName, String switchState, String currentSwitch, int currentLevel, String switchLatestValue) {
+ Switch(Closure sendEvent, String id, String label, String displayName, String switchState, String currentSwitch, int currentLevel, String switchLatestValue) {
this.sendEvent = sendEvent
this.timers = new SimulatedTimer()
this.currentSwitch = currentSwitch
this.switchState = "on"
this.currentSwitch = "on"
sendEvent([name: "switch", value: "on", deviceId: this.id, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "on"]])
}
def on(LinkedHashMap metaData) {
this.switchState = "on"
this.currentSwitch = "on"
sendEvent([name: "switch", value: "on", deviceId: this.id, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "on"]])
}
}
this.switchState = "off"
this.currentSwitch = "off"
sendEvent([name: "switch", value: "off", deviceId: this.id, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "off"]])
}
def off(LinkedHashMap metaData) {
this.switchState = "off"
this.currentSwitch = "off"
sendEvent([name: "switch", value: "off", deviceId: this.id, descriptionText: "",
- displayed: true, linkText: "", isStateChange: false, unit: "", data: []])
+ displayed: true, linkText: "", isStateChange: false, unit: "", data: [value: "off"]])
}
}