thermferm/devices.c

changeset 362
c92651a54969
parent 354
5ff387f4d6b7
child 392
034746506c3d
--- a/thermferm/devices.c	Thu May 14 22:03:35 2015 +0200
+++ b/thermferm/devices.c	Sat May 16 17:39:30 2015 +0200
@@ -31,6 +31,12 @@
 extern sys_config	Config;
 extern int		my_shutdown;
 
+#ifdef USE_SIMULATOR
+
+extern int	SIMcooling;
+extern int	SIMheating;
+
+#endif
 
 #ifdef HAVE_WIRINGPI_H
 
@@ -351,7 +357,19 @@
 
 #ifdef USE_SIMULATOR
 		if ((device->type == DEVTYPE_SIM) && (device->direction == DEVDIR_OUT_BIN) && (device->present == DEVPRESENT_YES)) {
-
+		    if ((strcmp((char *)"SimCooler", device->address) == 0) || (strcmp((char *)"SimHeater", device->address) == 0)) {
+			if (value != device->value) {
+			    syslog(LOG_NOTICE, "SIM %s value=%d", device->address, value);
+			    if (debug)
+			    	fprintf(stdout, "SIM %s value=%d\n", device->address, value);
+			}
+			device->value = value;
+			device->timestamp = time(NULL);
+			if (strcmp((char *)"SimCooler", device->address) == 0)
+			    SIMcooling = value;
+			if (strcmp((char *)"SimHeater", device->address) == 0)
+			    SIMheating = value;
+		    }
 		}
 #endif
 	    } else {

mercurial