bmsd/nodes.c

changeset 673
9924b1218d39
parent 672
23f959713fcb
child 675
a27af02ab16a
equal deleted inserted replaced
672:23f959713fcb 673:9924b1218d39
315 if (strcmp(tmpf->node, tmpn->node) == 0) { 315 if (strcmp(tmpf->node, tmpn->node) == 0) {
316 if (tmpf->online) { 316 if (tmpf->online) {
317 syslog(LOG_NOTICE, "Timeout fermenter %s/%s", tmpf->node, tmpf->alias); 317 syslog(LOG_NOTICE, "Timeout fermenter %s/%s", tmpf->node, tmpf->alias);
318 tmpf->online = false; 318 tmpf->online = false;
319 fermenter_mysql_death(tmpf->node, tmpf->alias); 319 fermenter_mysql_death(tmpf->node, tmpf->alias);
320 msg = xstrcpy((char *)"{\"device\":\"fermenter\",\"node\":\"");
321 msg = xstrcat(msg, tmpf->node);
322 msg = xstrcat(msg, (char *)"\",\"unit\":\"");
323 msg = xstrcat(msg, tmpf->alias);
324 msg = xstrcat(msg, (char *)"\",\"online\":0}");
325 ws_broadcast(msg);
326 free(msg);
327 msg = NULL;
320 } 328 }
321 } 329 }
322 } 330 }
323 331
324 for (tmpc = co2meters; tmpc; tmpc = tmpc->next) { 332 for (tmpc = co2meters; tmpc; tmpc = tmpc->next) {
325 if (strcmp(tmpc->node, tmpn->node) == 0) { 333 if (strcmp(tmpc->node, tmpn->node) == 0) {
326 if (tmpc->online) { 334 if (tmpc->online) {
327 syslog(LOG_NOTICE, "Timeout co2meter %s/%s", tmpc->node, tmpc->alias); 335 syslog(LOG_NOTICE, "Timeout co2meter %s/%s", tmpc->node, tmpc->alias);
328 tmpc->online = false; 336 tmpc->online = false;
329 co2meter_mysql_death(tmpc->node, tmpc->alias); 337 co2meter_mysql_death(tmpc->node, tmpc->alias);
338 msg = xstrcpy((char *)"{\"device\":\"co2meter\",\"node\":\"");
339 msg = xstrcat(msg, tmpc->node);
340 msg = xstrcat(msg, (char *)"\",\"unit\":\"");
341 msg = xstrcat(msg, tmpc->alias);
342 msg = xstrcat(msg, (char *)"\",\"online\":0}");
343 ws_broadcast(msg);
344 free(msg);
345 msg = NULL;
330 } 346 }
331 } 347 }
332 } 348 }
333 349
334 for (tmpi = ispindels; tmpi; tmpi = tmpi->next) { 350 for (tmpi = ispindels; tmpi; tmpi = tmpi->next) {
335 if (strcmp(tmpi->node, tmpn->node) == 0) { 351 if (strcmp(tmpi->node, tmpn->node) == 0) {
336 if (tmpi->online) { 352 if (tmpi->online) {
337 syslog(LOG_NOTICE, "Timeout ispindel %s", tmpi->node); 353 syslog(LOG_NOTICE, "Timeout ispindel %s", tmpi->node);
338 tmpi->online = false; 354 tmpi->online = false;
339 ispindel_mysql_death(tmpi->node); 355 ispindel_mysql_death(tmpi->node);
356 msg = xstrcpy((char *)"{\"device\":\"ispindel\",\"node\":\"");
357 msg = xstrcat(msg, tmpi->node);
358 msg = xstrcat(msg, (char *)"\",\"unit\":\"");
359 msg = xstrcat(msg, tmpi->alias);
360 msg = xstrcat(msg, (char *)"\",\"online\":0}");
361 ws_broadcast(msg);
362 free(msg);
363 msg = NULL;
340 } 364 }
341 } 365 }
342 } 366 }
343 } 367 }
344 } 368 }

mercurial