   time_t last_change;
 };
 
-// simple conditions for logical operations.
+#define METHOD_TURNON      1
+#define METHOD_CHANGELIMIT 2
+
+// simple conditions for operations
 struct condition {
   int id;
   struct ad *source;
-  char op;
-  dig2a value;
-  struct outIo *target;
-  int state;
+  struct variable *limit;
+  struct variable *limit2;
+  void *target;
+  int method;
 };
 
 
 struct variable variables[]= {
-  {"boilTemp",60.0},
-  {"radiatorTemp",20.0}
-};
+  {"boilTemp",      24.5},
+  {"boilHysteresis", 1.5},
+  {"boilReduced",   24.0},
+  {"hhboil",        25.0},
+  {"radiatorTemp",  20.0}
+};
+
+struct variable *origVariables;
 
 // in future this table shall be stored mainly in eeprom.
 // and so is it's size

{
  float value;
  float limit;

  for (int i=0;i<sizeof(conditions) / sizeof(struct condition);i++) {
    if (conditions[i].source == source) {
      value=source->measured.analog;
      limit=conditions[i].value.analog;
      switch (conditions[i].op) {
      case '<':
	if (value < limit && conditions[i].target->state != conditions[i].state) {
	  conditions[i].target->state = conditions[i].state;
	  conditions[i].target->last_change = ts;
	  digitalWrite(conditions[i].target->port,conditions[i].target->state);
	  Serial.print(source->name);
	  Serial.print(" is smaller than ");
	  Serial.print(limit);
          Serial.print(" turning ");
	  Serial.print(conditions[i].target->name);
	  Serial.print(" port [");
	  Serial.print(conditions[i].target->port);
	  Serial.print("] to ");
	  Serial.println(conditions[i].state);
	}
	break;

      case '>':
	if (value > limit && conditions[i].target->state != conditions[i].state) {
	  conditions[i].target->state = conditions[i].state;
	  conditions[i].target->last_change = ts;
	  digitalWrite(conditions[i].target->port,conditions[i].target->state);
	  Serial.print(source->name);
	  Serial.print(" is bigger than ");
	  Serial.print(limit);
          Serial.print(" turning ");
	  Serial.print(conditions[i].target->name);
	  Serial.print(" port [");
	  Serial.print(conditions[i].target->port);
	  Serial.print("] to ");
	  Serial.println(conditions[i].state);
	}
	break;

      default:
	Serial.println("unknown conditional op");
      }
    }
  }

  pinMode(12, OUTPUT);
  Serial.println("Start");
  eepReadAll();
  origVariables=(struct variable *) malloc(sizeof(variables));
  memcpy(origVariables,variables,sizeof(variables));
  // preparing for configurable channels.
  // in future the amount of channels will be specified with config
  // and this amount with channel names are saved to eeprom.
