Update notify-me-with-hue.groovy
[smartapps.git] / official / auto-humidity-vent.groovy
index a0d45441eb4361e9eed776133458dca291d67f1e..527f253d75eae5bf5e052712375657c8d7b8ca2e 100755 (executable)
@@ -226,26 +226,27 @@ def set_fans(fan_state) {
     } else {
        if (state.fansOn == true) {
                send("${app.label} fans Off.")
-            state.fansLastRunTime = (now() - state.fansOnTime)
+               //state.fansLastRunTime = (now() - state.fansOnTime)
 
-                   BigInteger ms = new java.math.BigInteger(state.fansLastRunTime)
-                       int seconds = (BigInteger) (((BigInteger) ms / (1000I))                  % 60I)
-                       int minutes = (BigInteger) (((BigInteger) ms / (1000I * 60I))            % 60I)
-                       int hours   = (BigInteger) (((BigInteger) ms / (1000I * 60I * 60I))      % 24I)
-                       int days    = (BigInteger)  ((BigInteger) ms / (1000I * 60I * 60I * 24I))
+               //    BigInteger ms = new java.math.BigInteger(state.fansLastRunTime)
+               //      int seconds = (BigInteger) (((BigInteger) ms / (1000I))                  % 60I)
+               //      int minutes = (BigInteger) (((BigInteger) ms / (1000I * 60I))            % 60I)
+               //      int hours   = (BigInteger) (((BigInteger) ms / (1000I * 60I * 60I))      % 24I)
+               //      int days    = (BigInteger)  ((BigInteger) ms / (1000I * 60I * 60I * 24I))
 
-                       def sb = String.format("${app.label} cycle: %d:%02d:%02d:%02d", days, hours, minutes, seconds)
+               //      def sb = String.format("${app.label} cycle: %d:%02d:%02d:%02d", days, hours, minutes, seconds)
                        
-                   send(sb)
+               //    send(sb)
 
-                       if (settings.fan_control_enabled) {
+       if (settings.fan_control_enabled) {
                fans.off()
                 if (emeters) {
                     log.debug emeters.currentValue('energy')
                     //TODO: How to ensure latest (most accurate) energy reading?
-                    emeters.poll() //[configure, refresh, on, off, poll, reset]
+                    //emeters.poll() //[configure, refresh, on, off, poll, reset]
 //                    emeters.refresh() //[configure, refresh, on, off, poll, reset]
-                    state.fansLastRunEnergy = emeters.currentValue('energy').sum()
+                    //state.fansLastRunEnergy = emeters.currentValue('energy').sum()
+                    state.fansLastRunEnergy = emeters.currentValue('energy')
                     state.fansLastRunCost = ((state.fansLastRunEnergy * price_kwh) / 100.0) 
                     send("${app.label} cycle: ${state.fansLastRunEnergy}kWh @ \$${state.fansLastRunCost}")
                 }