bmsd/co2meters.c

changeset 680
0bb48333d133
parent 678
14322825cb3d
child 684
ccb9f24d0fe9
equal deleted inserted replaced
679:48f8f3fce7c0 680:0bb48333d133
50 msg = xstrcat(msg, co2meter->alias); 50 msg = xstrcat(msg, co2meter->alias);
51 msg = xstrcat(msg, (char *)"\",\"online\":"); 51 msg = xstrcat(msg, (char *)"\",\"online\":");
52 msg = xstrcat(msg, co2meter->online ? (char *)"1":(char *)"0"); 52 msg = xstrcat(msg, co2meter->online ? (char *)"1":(char *)"0");
53 msg = xstrcat(msg, (char *)",\"mode\":\""); 53 msg = xstrcat(msg, (char *)",\"mode\":\"");
54 msg = xstrcat(msg, co2meter->mode); 54 msg = xstrcat(msg, co2meter->mode);
55 msg = xstrcat(msg, (char *)"\",\"beeruuid\":\"");
56 msg = xstrcat(msg, co2meter->beeruuid);
55 msg = xstrcat(msg, (char *)"\",\"beercode\":\""); 57 msg = xstrcat(msg, (char *)"\",\"beercode\":\"");
56 msg = xstrcat(msg, co2meter->beercode); 58 msg = xstrcat(msg, co2meter->beercode);
57 msg = xstrcat(msg, (char *)"\",\"beername\":\""); 59 msg = xstrcat(msg, (char *)"\",\"beername\":\"");
58 msg = xstrcat(msg, co2meter->beername); 60 msg = xstrcat(msg, co2meter->beername);
61 msg = xstrcat(msg, (char *)"\",\"temperature_state\":\"");
62 msg = xstrcat(msg, co2meter->temperature_state);
63 msg = xstrcat(msg, (char *)"\",\"temperature_address\":\"");
64 msg = xstrcat(msg, co2meter->temperature_address);
59 msg = xstrcat(msg, (char *)"\",\"temperature\":"); 65 msg = xstrcat(msg, (char *)"\",\"temperature\":");
60 snprintf(buf, 64, "%.3f", co2meter->temperature); 66 snprintf(buf, 64, "%.3f", co2meter->temperature);
61 msg = xstrcat(msg, buf); 67 msg = xstrcat(msg, buf);
62 msg = xstrcat(msg, (char *)",\"pressure_channel\":"); 68 msg = xstrcat(msg, (char *)",\"pressure_state\":\"");
69 msg = xstrcat(msg, co2meter->pressure_state);
70 msg = xstrcat(msg, (char *)"\",\"pressure_channel\":");
63 snprintf(buf, 64, "%d", co2meter->pressure_channel); 71 snprintf(buf, 64, "%d", co2meter->pressure_channel);
64 msg = xstrcat(msg, buf); 72 msg = xstrcat(msg, buf);
65 msg = xstrcat(msg, (char *)",\"pressure_voltage\":"); 73 msg = xstrcat(msg, (char *)",\"pressure_voltage\":");
66 snprintf(buf, 64, "%.3f", co2meter->pressure_voltage); 74 snprintf(buf, 64, "%.3f", co2meter->pressure_voltage);
67 msg = xstrcat(msg, buf); 75 msg = xstrcat(msg, buf);
76 msg = xstrcat(msg, buf); 84 msg = xstrcat(msg, buf);
77 msg = xstrcat(msg, (char *)"}"); 85 msg = xstrcat(msg, (char *)"}");
78 ws_broadcast(msg); 86 ws_broadcast(msg);
79 free(msg); 87 free(msg);
80 msg = NULL; 88 msg = NULL;
81
82 } 89 }
83 90
84 91
85 92
86 void co2meter_ws_receive(char *payload) 93 void co2meter_ws_receive(char *payload)

mercurial