1 //Create a class for switch device
4 public class switching{
10 this.Timers = new Timer()
13 switches = [new switches(0, "switch0", "off", "off")]
14 } else if (count == 2) {
15 switches = [new switches(0, "switch0", "off", "off"),new switches(1, "switch1", "off", "off")]
16 } else if (count == 3) {
17 switches = [new switches(0, "switch0", "off", "off"),new switches(1, "switch1", "off", "off"),new switches(2, "switch2", "off", "off")]
29 def on(LinkedHashMap LHM) {
31 def task = Timers.runAfter(LHM["delay"]) {
35 def task = Timers.runAfter(LHM["delay"]) {
49 def off(LinkedHashMap LHM) {
51 def task = Timers.runAfter(LHM["delay"]) {
55 def task = Timers.runAfter(LHM["delay"]) {
61 def currentValue(String S) {
63 switches[0].currentValue(S)
65 switches*.currentValue(S)
69 def latestValue(String S) {
71 switches[0].latestValue(S)
73 switches*.latestValue(S)