daily pastebin goal
26%
SHARE
TWEET

openremote calendar drl

a guest Oct 12th, 2013 41 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package org.openremote.controller.protocol
  2.  
  3. declare Temperature
  4.     defaultTargetTemperature : float
  5.     targetTemperature : float
  6.     currentTemperature : float
  7.     calendarPath : String
  8. end
  9.  
  10. rule "Temperature"
  11.         when
  12.             not Temperature()
  13.         then
  14.                 Temperature t = new Temperature();
  15.                 t.setCalendarPath(/path/to/ical/file.ics);
  16.                 float calendarTemp = CalendarProvider.getCalendarTemperature(t.getCalendarPath());
  17.                 t.setDefaultTargetTemperature(19);
  18.                 t.setTargetTemperature(calendarTemp);
  19.             insert( t );
  20. end
  21.  
  22. rule "Refresh target temperature every minute"
  23.                 timer (cron: 0 * * * * ?)
  24.             no-loop
  25.         when
  26.                 t : Temperature ( )
  27.         then
  28.                 float calendarTemp = CalendarProvider.getCalendarTemperature(t.getCalendarPath());
  29.                 if (calendarTemp != -1 && t.getTargetTemperature() != calendarTemp) {
  30.                         t.setTargetTemperature(calendarTemp);
  31.                         update( t );
  32.                 }
  33. end
  34.  
  35. rule "Target temperatur changed"
  36.                 no-loop
  37.         when
  38.             t : Temperature ( )
  39.         then
  40.                 System.out.println( "New target temperature: " + String.valueOf(t.getTargetTemperature()) );
  41. 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
 
Top