bmsd/fermenters.c

changeset 718
59b02b64131b
parent 705
d77b723f7b35
child 790
98bd22f6629b
equal deleted inserted replaced
717:aad750d942df 718:59b02b64131b
184 char *node = NULL, *alias = NULL, *beeruuid = NULL, *beercode = NULL, *beername = NULL; 184 char *node = NULL, *alias = NULL, *beeruuid = NULL, *beercode = NULL, *beername = NULL;
185 char *mode = NULL, *stage = NULL, *profile = NULL, *profile_uuid = NULL, *profile_name = NULL, *profile_steps = NULL; 185 char *mode = NULL, *stage = NULL, *profile = NULL, *profile_uuid = NULL, *profile_name = NULL, *profile_steps = NULL;
186 char *topic = NULL, *pay = NULL, buf[75], *profile_command = NULL; 186 char *topic = NULL, *pay = NULL, buf[75], *profile_command = NULL;
187 float setpoint_low = 0, setpoint_high = 0, yeast_lo = 0, yeast_hi = 0, inittemp_lo = 0, inittemp_hi = 0; 187 float setpoint_low = 0, setpoint_high = 0, yeast_lo = 0, yeast_hi = 0, inittemp_lo = 0, inittemp_hi = 0;
188 int heater_state = -1, cooler_state = -1, fan_state = -1, light_state = -1, profile_fridgemode = -1; 188 int heater_state = -1, cooler_state = -1, fan_state = -1, light_state = -1, profile_fridgemode = -1;
189
190 syslog(LOG_NOTICE, "fermenter_ws_receive(%s)", payload);
191 189
192 /* 190 /*
193 * Process the JSON formatted payload. 191 * Process the JSON formatted payload.
194 */ 192 */
195 jobj = json_tokener_parse(payload); 193 jobj = json_tokener_parse(payload);
444 { 442 {
445 struct json_object *jobj, *val, *sensor, *temp; 443 struct json_object *jobj, *val, *sensor, *temp;
446 sys_fermenter_list *fermenter, *tmpp; 444 sys_fermenter_list *fermenter, *tmpp;
447 bool new_fermenter = true; 445 bool new_fermenter = true;
448 446
449 //syslog(LOG_NOTICE, "fermenter_set: %s/%s %s %s", edge_node, alias, birth ? "BIRTH":"DATA", payload);
450
451 /* 447 /*
452 * Search fermenter record in the memory array and use it if found. 448 * Search fermenter record in the memory array and use it if found.
453 */ 449 */
454 if (fermenters) { 450 if (fermenters) {
455 for (tmpp = fermenters; tmpp; tmpp = tmpp->next) { 451 for (tmpp = fermenters; tmpp; tmpp = tmpp->next) {
463 459
464 if (! birth && new_fermenter) { 460 if (! birth && new_fermenter) {
465 printf("ERROR got DDATA and fermenter %s/%s doesn't exist\n", edge_node, alias); 461 printf("ERROR got DDATA and fermenter %s/%s doesn't exist\n", edge_node, alias);
466 return; 462 return;
467 } 463 }
468 //printf("new_fermenter %s\n", new_fermenter ? "true":"false");
469 464
470 /* 465 /*
471 * Allocate new fermenter if not yet known. 466 * Allocate new fermenter if not yet known.
472 */ 467 */
473 if (new_fermenter) { 468 if (new_fermenter) {

mercurial