changes in switch level class
authorSeyed Amir Hossein Aqajari <saqajari@circinus-21.ics.uci.edu>
Fri, 15 Nov 2019 22:38:28 +0000 (14:38 -0800)
committerSeyed Amir Hossein Aqajari <saqajari@circinus-21.ics.uci.edu>
Fri, 15 Nov 2019 22:38:28 +0000 (14:38 -0800)
SwitchLevel/SwitchLevel.groovy
SwitchLevel/SwitchLevels.groovy

index 2b5020eab7b4334234e02e550919768618d25b60..ac7895733f874a70fe2af93a47784c10d2e39c68 100644 (file)
@@ -15,6 +15,7 @@ public class SwitchLevel {
        private int hue
        private int currentHue
        private int saturation
+       private int currentSaturation
        private String switchLatestValue
        def sendEvent   
        def timers
@@ -33,6 +34,7 @@ public class SwitchLevel {
                this.hue = hue
                this.currentHue = hue
                this.saturation = saturation
+               this.currentSaturation = saturation
                this.switchState = switchState
                this.currentSwitch = switchState
                this.switchLatestValue = switchLatestValue
@@ -48,6 +50,7 @@ public class SwitchLevel {
                        this.hue = metaData["hue"]
                        this.currentHue = metaData["hue"]
                        this.saturation = metaData["saturation"]
+                       this.currentSaturation = metaData["saturation"]
                        println("the switch with id:$id is setted to level $level and hue to $hue and saturation to $saturation!")
                        sendEvent([name: "level", value: "$level", deviceId: this.id, descriptionText: "",
                                   displayed: true, linkText: "", isStateChange: false, unit: "", data: '{"info": "info"}'])
index bc9140cc4344c844f06a23bdf562ee654790c41f..773c1ccfad8e37d48107045e1b7768a2a2e2cc48 100644 (file)
@@ -19,6 +19,7 @@ public class SwitchLevels {
        private int hue = 30
        private int currentHue = 30
        private int saturation = 70
+       private int currentSaturation = 70
        private String switchState = "on"
        private String currentSwitch = "on"
        private String switchLatestValue = "on"
@@ -37,6 +38,7 @@ public class SwitchLevels {
                        this.hue = 30
                        this.currentHue = 30
                        this.saturation = 70
+                       this.currentSaturation = 70
                        this.switchState = "off"
                        this.currentSwitch = "off"
                        this.switchLatestValue = "off"
@@ -48,6 +50,7 @@ public class SwitchLevels {
                        this.hue = 50
                        this.currentHue = 50
                        this.saturation = 90
+                       this.currentSaturation = 90
                        this.switchState = "on"
                        this.currentSwitch = "on"
                        this.switchLatestValue = "on"
@@ -85,6 +88,7 @@ public class SwitchLevels {
                        this.hue = metaData["hue"]
                        this.currentHue = metaData["hue"]
                        this.saturation = metaData["saturation"]
+                       this.currentSaturation = metaData["saturation"]
                        switchLevels[0].setColor(metaData)
                }
        }