diff -r 9c41e865144a -r a8a6901b5a99 bmsd/nodes.c --- a/bmsd/nodes.c Wed Oct 09 22:39:46 2019 +0200 +++ b/bmsd/nodes.c Thu Oct 10 20:42:39 2019 +0200 @@ -3,7 +3,7 @@ * @brief Handle nodes status * @author Michiel Broek * - * Copyright (C) 2018 + * Copyright (C) 2018-2019 * * This file is part of the bms (Brewery Management System) * @@ -33,6 +33,8 @@ extern int debug; extern sys_fermenter_list *fermenters; +extern sys_co2meter_list *co2meters; + void node_birth_data(char *topic, char *payload) @@ -244,6 +246,7 @@ { sys_node_list *tmpn; sys_fermenter_list *tmpf; + sys_co2meter_list *tmpc; time_t now = time(NULL); for (tmpn = nodes; tmpn; tmpn = tmpn->next) { @@ -261,6 +264,16 @@ } } } + + for (tmpc = co2meters; tmpc; tmpc = tmpc->next) { + if (strcmp(tmpc->node, tmpn->node) == 0) { + if (tmpc->online) { + syslog(LOG_NOTICE, "Timeout co2meter %s/%s", tmpc->node, tmpc->alias); + tmpc->online = false; + co2meter_mysql_death(tmpc->node, tmpc->alias); + } + } + } } } }