bmsd/nodes.c

changeset 673
9924b1218d39
parent 672
23f959713fcb
child 675
a27af02ab16a
--- a/bmsd/nodes.c	Mon May 11 22:09:41 2020 +0200
+++ b/bmsd/nodes.c	Tue May 12 13:16:25 2020 +0200
@@ -317,6 +317,14 @@
                     	syslog(LOG_NOTICE, "Timeout fermenter %s/%s", tmpf->node, tmpf->alias);
                 	tmpf->online = false;
 			fermenter_mysql_death(tmpf->node, tmpf->alias);
+			msg = xstrcpy((char *)"{\"device\":\"fermenter\",\"node\":\"");
+            		msg = xstrcat(msg, tmpf->node);
+			msg = xstrcat(msg, (char *)"\",\"unit\":\"");
+    			msg = xstrcat(msg, tmpf->alias);
+            		msg = xstrcat(msg, (char *)"\",\"online\":0}");
+            		ws_broadcast(msg);
+            		free(msg);
+            		msg = NULL;
 		    }
             	}
             }
@@ -327,6 +335,14 @@
 			syslog(LOG_NOTICE, "Timeout co2meter %s/%s", tmpc->node, tmpc->alias);
 			tmpc->online = false;
 			co2meter_mysql_death(tmpc->node, tmpc->alias);
+			msg = xstrcpy((char *)"{\"device\":\"co2meter\",\"node\":\"");
+                        msg = xstrcat(msg, tmpc->node);
+                        msg = xstrcat(msg, (char *)"\",\"unit\":\"");
+                        msg = xstrcat(msg, tmpc->alias);
+                        msg = xstrcat(msg, (char *)"\",\"online\":0}");
+                        ws_broadcast(msg);
+                        free(msg);
+                        msg = NULL;
 		    }
 		}
 	    }
@@ -337,6 +353,14 @@
                         syslog(LOG_NOTICE, "Timeout ispindel %s", tmpi->node);
                         tmpi->online = false;
                         ispindel_mysql_death(tmpi->node);
+			msg = xstrcpy((char *)"{\"device\":\"ispindel\",\"node\":\"");
+                        msg = xstrcat(msg, tmpi->node);
+                        msg = xstrcat(msg, (char *)"\",\"unit\":\"");
+                        msg = xstrcat(msg, tmpi->alias);
+                        msg = xstrcat(msg, (char *)"\",\"online\":0}");
+                        ws_broadcast(msg);
+                        free(msg);
+                        msg = NULL;
                     }
 		}
 	    }

mercurial