SHARE
TWEET

temp rule - working

friedpenguin Sep 4th, 2016 (edited) 97 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import org.openhab.core.library.types.*
  2. import org.openhab.core.persistence.*
  3. import org.openhab.model.script.actions.*
  4.  
  5. var Timer waitTimer = null
  6. var boolean sentTemperature = false
  7. rule "It's getting hot in here"
  8.  
  9. when
  10.         Item ponicsATemp changed
  11. then
  12.         logInfo("Temperature: ", ponicsATemp.state.toString())
  13.         if (!sentTemperature && ponicsATemp.state > 80) {
  14.                 sendCommand(garageFans, ON)
  15.                 sentTemperature = true
  16.                 waitTimer = createTimer(now.plusMinutes(2))[|
  17.                         sentTemperature = false
  18.                 ]
  19.         }
  20. end
  21.  
  22.  
  23. ##### I have since split this into a second rule for consistent results. If you choose to use it that way copy the first six lines of text into the 'rule' below and change the name of the last line for your needs ######
  24.  
  25. rule "Ah, cooler now"
  26.  
  27. when
  28.         Item ponicsATemp changed
  29. then
  30.         logInfo("Temperature: ", ponicsATemp.state.toString())
  31.         if (!sentTemperature && ponicsATemp.state < 79) {
  32.                 sendCommand(garageFans, OFF)
  33.                 sentTemperature = true
  34.                 waitTimer = createTimer(now.plusMinutes(2))[|
  35.                         sentTemperature = false
  36.                 ]
  37.         }
  38. end
RAW Paste Data
Top