SHARE
TWEET

Untitled

a guest Jul 19th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. rule "Dim Up"
  2. when
  3.     Item HueDimmerSwitch received update 2000
  4. then
  5.     logInfo("Light", "Start Dim Up")
  6.     timer = createTimer(now.plusMillis(800), [|
  7.  
  8.         var dimmstate = (HueDimmerSwitch.state as DecimalType).intValue
  9.         if(Lastlight == 0 && dimmstate == 2001){
  10.             var PercentType currentState = Whz_Dimmer.getStateAs(PercentType)
  11.             var PercentType bright
  12.             if(currentState.intValue < 95 ) {
  13.                 bright = new PercentType(currentState.intValue + Dimmstep)     
  14.             } else if (currentState.intValue > 94 ){
  15.                 bright = new PercentType(100)
  16.             }
  17.  
  18.             sendCommand(Whz_Dimmer, bright as Number)
  19.             logInfo("Light", "Dim Up")
  20.             timer.reschedule(now)
  21.         } else if(Lastlight == 1 && dimmstate == 2001){
  22.             var PercentType currentState = Wohnzimmer_Ambiente.getStateAs(PercentType)
  23.             var PercentType bright
  24.             if(currentState.intValue < 95 ) {
  25.                 bright = new PercentType(currentState.intValue + Dimmstep)     
  26.             }
  27.             else if (currentState.intValue > 94 ){
  28.                 bright = new PercentType(100)
  29.             }
  30.  
  31.             sendCommand(Wohnzimmer_Ambiente, bright as Number)
  32.             logInfo("Light", "Dim Up")
  33.             timer.reschedule(now)  
  34.         } else if(dimmstate == 2000 && timer !== null){
  35.             logInfo("Light", "wait")
  36.             timer.reschedule(now)
  37.         }
  38.     ])
  39. end
  40.  
  41. rule "Dim up one step"
  42. when
  43.     Item HueDimmerSwitch received update 2002
  44. then
  45.     logInfo("Light", "Start Dim Up one step")
  46.         if(Lastlight == 0){
  47.             var PercentType currentState = Whz_Dimmer.getStateAs(PercentType)
  48.             var PercentType bright
  49.             if(currentState.intValue < 95 ) {
  50.                 bright = new PercentType(currentState.intValue + Dimmstep)     
  51.             } else if (currentState.intValue > 94 ){
  52.                 bright = new PercentType(100)
  53.             }
  54.  
  55.             sendCommand(Whz_Dimmer, bright as Number)
  56.             logInfo("Light", "Dim Up")
  57.         } else if(Lastlight == 1){
  58.             var PercentType currentState = Wohnzimmer_Ambiente.getStateAs(PercentType)
  59.             var PercentType bright
  60.             if(currentState.intValue < 95 ) {
  61.                 bright = new PercentType(currentState.intValue + Dimmstep)     
  62.             }
  63.             else if (currentState.intValue > 94 ){
  64.                 bright = new PercentType(100)
  65.             }
  66.             sendCommand(Wohnzimmer_Ambiente, bright as Number)
  67.             logInfo("Light", "Dim Up")
  68.         }
  69. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top