bmsd/fermenters.c

Wed, 15 Jul 2020 16:03:23 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 15 Jul 2020 16:03:23 +0200
changeset 705
d77b723f7b35
parent 698
c7b4cb53b37c
child 718
59b02b64131b
permissions
-rw-r--r--

Make sure enumerated values are not empty in database updates. On several data queries set the database connection to UTF-8.

0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1 /**
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
2 * @file fermenters.c
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
3 * @brief Handle fermenters status
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
4 * @author Michiel Broek <mbroek at mbse dot eu>
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
5 *
671
4b54d6f79d25 Version 0.3.33 Added websockets framework. Added fermenter status messages to the websockets broadcast.
Michiel Broek <mbroek@mbse.eu>
parents: 558
diff changeset
6 * Copyright (C) 2018-2020
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
7 *
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
8 * This file is part of the bms (Brewery Management System)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
9 *
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
10 * This is free software; you can redistribute it and/or modify it
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
11 * under the terms of the GNU General Public License as published by the
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
12 * Free Software Foundation; either version 2, or (at your option) any
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
13 * later version.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
14 *
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
15 * bms is distributed in the hope that it will be useful, but
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
18 * General Public License for more details.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
19 *
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
21 * along with ThermFerm; see the file COPYING. If not, write to the Free
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
22 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
23 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
24
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
25
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
26 #include "bms.h"
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
27 #include "xutil.h"
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
28 #include "fermenters.h"
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
29 #include "mysql.h"
679
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
30 #include "mqtt.h"
671
4b54d6f79d25 Version 0.3.33 Added websockets framework. Added fermenter status messages to the websockets broadcast.
Michiel Broek <mbroek@mbse.eu>
parents: 558
diff changeset
31 #include "websocket.h"
684
ccb9f24d0fe9 Report any online status change via websocket broadcast. When starting, load all in memory tables sorted. The websocket status on the web pages has it's own panel. Prepared the menu system for dynamic updates.
Michiel Broek <mbroek@mbse.eu>
parents: 679
diff changeset
32 #include "nodes.h"
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
33
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
34
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
35 sys_fermenter_list *fermenters = NULL;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
36
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
37 extern int debug;
194
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
38 extern sys_config Config;
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
39
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
40
679
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
41 void fermenter_ws_send(sys_fermenter_list *fermenter)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
42 {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
43 char *msg = NULL, buf[65];
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
44
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
45 msg = xstrcpy((char *)"{\"device\":\"fermenters\",\"node\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
46 msg = xstrcat(msg, fermenter->node);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
47 msg = xstrcat(msg, (char *)"\",\"unit\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
48 msg = xstrcat(msg, fermenter->alias);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
49 msg = xstrcat(msg, (char *)"\",\"online\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
50 msg = xstrcat(msg, fermenter->online ? (char *)"1":(char *)"0");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
51 msg = xstrcat(msg, (char *)",\"mode\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
52 msg = xstrcat(msg, fermenter->mode);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
53 msg = xstrcat(msg, (char *)"\",\"beeruuid\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
54 msg = xstrcat(msg, fermenter->beeruuid);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
55 msg = xstrcat(msg, (char *)"\",\"beercode\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
56 msg = xstrcat(msg, fermenter->beercode);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
57 msg = xstrcat(msg, (char *)"\",\"beername\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
58 msg = xstrcat(msg, fermenter->beername);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
59 msg = xstrcat(msg, (char *)"\",\"yeast_lo\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
60 snprintf(buf, 64, "%.3f", fermenter->yeast_lo);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
61 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
62 msg = xstrcat(msg, (char *)",\"yeast_hi\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
63 snprintf(buf, 64, "%.3f", fermenter->yeast_hi);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
64 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
65 if (fermenter->air_address) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
66 msg = xstrcat(msg, (char *)",\"air_state\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
67 msg = xstrcat(msg, fermenter->air_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
68 msg = xstrcat(msg, (char *)"\",\"air_temperature\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
69 snprintf(buf, 64, "%.3f", fermenter->air_temperature);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
70 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
71 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
72 if (fermenter->beer_address) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
73 msg = xstrcat(msg, (char *)",\"beer_state\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
74 msg = xstrcat(msg, fermenter->beer_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
75 msg = xstrcat(msg, (char *)"\",\"beer_temperature\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
76 snprintf(buf, 64, "%.3f", fermenter->beer_temperature);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
77 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
78 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
79 if (fermenter->chiller_address) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
80 msg = xstrcat(msg, (char *)",\"chiller_state\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
81 msg = xstrcat(msg, fermenter->chiller_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
82 msg = xstrcat(msg, (char *)"\",\"chiller_temperature\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
83 snprintf(buf, 64, "%.3f", fermenter->chiller_temperature);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
84 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
85 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
86 if (fermenter->heater_address) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
87 msg = xstrcat(msg, (char *)",\"heater_state\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
88 snprintf(buf, 64, "%d", fermenter->heater_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
89 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
90 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
91 if (fermenter->cooler_address) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
92 msg = xstrcat(msg, (char *)",\"cooler_state\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
93 snprintf(buf, 64, "%d", fermenter->cooler_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
94 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
95 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
96 if (fermenter->fan_address) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
97 msg = xstrcat(msg, (char *)",\"fan_state\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
98 snprintf(buf, 64, "%d", fermenter->fan_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
99 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
100 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
101 if (fermenter->light_address) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
102 msg = xstrcat(msg, (char *)",\"light_address\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
103 msg = xstrcat(msg, fermenter->light_address);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
104 msg = xstrcat(msg, (char *)"\",\"light_state\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
105 snprintf(buf, 64, "%d", fermenter->light_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
106 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
107 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
108 if (fermenter->door_address) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
109 msg = xstrcat(msg, (char *)",\"door_address\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
110 msg = xstrcat(msg, fermenter->door_address);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
111 msg = xstrcat(msg, (char *)"\",\"door_state\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
112 snprintf(buf, 64, "%d", fermenter->door_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
113 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
114 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
115 if (fermenter->psu_address) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
116 msg = xstrcat(msg, (char *)",\"psu_address\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
117 msg = xstrcat(msg, fermenter->psu_address);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
118 msg = xstrcat(msg, (char *)"\",\"psu_state\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
119 snprintf(buf, 64, "%d", fermenter->psu_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
120 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
121 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
122 msg = xstrcat(msg, (char *)",\"setpoint_low\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
123 snprintf(buf, 64, "%.3f", fermenter->setpoint_low);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
124 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
125 msg = xstrcat(msg, (char *)",\"setpoint_high\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
126 snprintf(buf, 64, "%.3f", fermenter->setpoint_high);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
127 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
128 msg = xstrcat(msg, (char *)",\"alarm\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
129 snprintf(buf, 64, "%d", fermenter->alarm);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
130 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
131 msg = xstrcat(msg, (char *)",\"stage\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
132 msg = xstrcat(msg, fermenter->stage);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
133 msg = xstrcat(msg, (char *)"\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
134
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
135 if (fermenter->profile_uuid) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
136 msg = xstrcat(msg, (char *)",\"profile_uuid\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
137 msg = xstrcat(msg, fermenter->profile_uuid);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
138 msg = xstrcat(msg, (char *)"\",\"profile_name\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
139 msg = xstrcat(msg, fermenter->profile_name);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
140 msg = xstrcat(msg, (char *)"\",\"profile_state\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
141 msg = xstrcat(msg, fermenter->profile_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
142 msg = xstrcat(msg, (char *)"\",\"profile_percent\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
143 snprintf(buf, 64, "%d", fermenter->profile_percent);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
144 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
145 msg = xstrcat(msg, (char *)",\"profile_inittemp_high\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
146 snprintf(buf, 64, "%.3f", fermenter->profile_inittemp_high);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
147 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
148 msg = xstrcat(msg, (char *)",\"profile_inittemp_low\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
149 snprintf(buf, 64, "%.3f", fermenter->profile_inittemp_low);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
150 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
151 msg = xstrcat(msg, (char *)",\"profile_steps\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
152 msg = xstrcat(msg, fermenter->profile_steps);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
153 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
154
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
155 msg = xstrcat(msg, (char *)",\"webcam_url\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
156 msg = xstrcat(msg, fermenter->webcam_url);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
157 msg = xstrcat(msg, (char *)"\",\"webcam_light\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
158 snprintf(buf, 64, "%d", fermenter->webcam_light);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
159 msg = xstrcat(msg, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
160 msg = xstrcat(msg, (char *)"}");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
161 ws_broadcast(msg);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
162 free(msg);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
163 msg = NULL;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
164 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
165
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
166
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
167
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
168 char *fermenter_paybase(void)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
169 {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
170 static char *tmp;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
171 char buf[33];
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
172
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
173 tmp = xstrcpy((char *)"{\"timestamp\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
174 snprintf(buf, 32, "%ld", time(NULL));
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
175 tmp = xstrcat(tmp, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
176 tmp = xstrcat(tmp, (char *)",\"metric\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
177 return tmp;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
178 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
179
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
180
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
181 void fermenter_ws_receive(char *payload)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
182 {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
183 struct json_object *jobj, *pobj, *iobj, *val;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
184 char *node = NULL, *alias = NULL, *beeruuid = NULL, *beercode = NULL, *beername = NULL;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
185 char *mode = NULL, *stage = NULL, *profile = NULL, *profile_uuid = NULL, *profile_name = NULL, *profile_steps = NULL;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
186 char *topic = NULL, *pay = NULL, buf[75], *profile_command = NULL;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
187 float setpoint_low = 0, setpoint_high = 0, yeast_lo = 0, yeast_hi = 0, inittemp_lo = 0, inittemp_hi = 0;
698
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
188 int heater_state = -1, cooler_state = -1, fan_state = -1, light_state = -1, profile_fridgemode = -1;
679
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
189
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
190 syslog(LOG_NOTICE, "fermenter_ws_receive(%s)", payload);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
191
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
192 /*
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
193 * Process the JSON formatted payload.
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
194 */
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
195 jobj = json_tokener_parse(payload);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
196 if (json_object_object_get_ex(jobj, "node", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
197 node = xstrcpy((char *)json_object_get_string(val));
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
198 if (json_object_object_get_ex(jobj, "unit", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
199 alias = xstrcpy((char *)json_object_get_string(val));
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
200 if (json_object_object_get_ex(jobj, "beeruuid", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
201 beeruuid = xstrcpy((char *)json_object_get_string(val));
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
202 if (json_object_object_get_ex(jobj, "beercode", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
203 beercode = xstrcpy((char *)json_object_get_string(val));
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
204 if (json_object_object_get_ex(jobj, "beername", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
205 beername = xstrcpy((char *)json_object_get_string(val));
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
206 if (json_object_object_get_ex(jobj, "mode", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
207 mode = xstrcpy((char *)json_object_get_string(val));
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
208 if (json_object_object_get_ex(jobj, "stage", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
209 stage = xstrcpy((char *)json_object_get_string(val));
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
210 if (json_object_object_get_ex(jobj, "setpoint_low", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
211 setpoint_low = json_object_get_double(val);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
212 if (json_object_object_get_ex(jobj, "setpoint_high", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
213 setpoint_high = json_object_get_double(val);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
214 if (json_object_object_get_ex(jobj, "yeast_lo", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
215 yeast_lo = json_object_get_double(val);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
216 if (json_object_object_get_ex(jobj, "yeast_hi", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
217 yeast_hi = json_object_get_double(val);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
218 if (json_object_object_get_ex(jobj, "heater_state", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
219 heater_state = json_object_get_int(val);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
220 if (json_object_object_get_ex(jobj, "cooler_state", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
221 cooler_state = json_object_get_int(val);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
222 if (json_object_object_get_ex(jobj, "fan_state", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
223 fan_state = json_object_get_int(val);
698
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
224 if (json_object_object_get_ex(jobj, "light_state", &val))
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
225 light_state = json_object_get_int(val);
679
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
226 if (json_object_object_get_ex(jobj, "profile", &pobj)) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
227 profile = xstrcpy((char *)json_object_get_string(pobj));
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
228 if (profile == NULL) { // clear profile request
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
229 profile = xstrcpy((char *)"null");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
230 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
231 if (json_object_object_get_ex(pobj, "uuid", &val)) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
232 profile_uuid = xstrcpy((char *)json_object_get_string(val));
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
233 syslog(LOG_NOTICE, "profile uuid");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
234 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
235 if (json_object_object_get_ex(pobj, "name", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
236 profile_name = xstrcpy((char *)json_object_get_string(val));
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
237 if (json_object_object_get_ex(pobj, "inittemp", &iobj)) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
238
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
239 if (json_object_object_get_ex(iobj, "low", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
240 inittemp_lo = json_object_get_double(val);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
241 if (json_object_object_get_ex(iobj, "high", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
242 inittemp_hi = json_object_get_double(val);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
243 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
244 if (json_object_object_get_ex(pobj, "fridgemode", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
245 profile_fridgemode = json_object_get_int(val);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
246 if (json_object_object_get_ex(pobj, "steps", &val))
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
247 profile_steps = xstrcpy((char *)json_object_get_string(val));
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
248 if (json_object_object_get_ex(pobj, "command", &val)) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
249 profile_command = xstrcpy((char *)json_object_get_string(val));
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
250 syslog(LOG_NOTICE, "profile command %s", profile_command);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
251 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
252 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
253 json_object_put(jobj);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
254
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
255 /*
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
256 * Prepare MQTT topic
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
257 */
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
258 topic = xstrcpy((char *)"mbv1.0/fermenters/DCMD/");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
259 topic = xstrcat(topic, node);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
260 topic = xstrcat(topic, (char *)"/");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
261 topic = xstrcat(topic, alias);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
262
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
263 if (node && alias) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
264 if (mode) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
265 syslog(LOG_NOTICE, "Set fermenter %s/%s mode %s", node, alias, mode);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
266 pay = fermenter_paybase();
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
267 pay = xstrcat(pay, (char *)"{\"mode\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
268 pay = xstrcat(pay, mode);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
269 pay = xstrcat(pay, (char *)"\"}}");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
270 mqtt_publish(topic, pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
271 free(pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
272 pay = NULL;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
273 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
274
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
275 if (stage) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
276 syslog(LOG_NOTICE, "Set fermenter %s/%s stage %s", node, alias, stage);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
277 pay = fermenter_paybase();
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
278 pay = xstrcat(pay, (char *)"{\"stage\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
279 pay = xstrcat(pay, stage);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
280 pay = xstrcat(pay, (char *)"\"}}");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
281 mqtt_publish(topic, pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
282 free(pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
283 pay = NULL;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
284 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
285
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
286 if (setpoint_low > 0 && setpoint_high > 0 && setpoint_high >= setpoint_low) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
287 syslog(LOG_NOTICE, "Set fermenter %s/%s setpoint %.1f %.1f", node, alias, setpoint_low, setpoint_high);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
288 pay = fermenter_paybase();
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
289 pay = xstrcat(pay, (char *)"{\"setpoint\":{\"low\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
290 snprintf(buf, 64, "%.1f", setpoint_low);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
291 pay = xstrcat(pay, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
292 pay = xstrcat(pay, (char *)",\"high\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
293 snprintf(buf, 64, "%.1f", setpoint_high);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
294 pay = xstrcat(pay, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
295 pay = xstrcat(pay, (char *)"}}}");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
296 mqtt_publish(topic, pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
297 free(pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
298 pay = NULL;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
299 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
300
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
301 if (heater_state >= 0) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
302 syslog(LOG_NOTICE, "Set fermenter %s/%s heater %d", node, alias, heater_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
303 pay = fermenter_paybase();
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
304 pay = xstrcat(pay, (char *)"{\"heater\":{\"state\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
305 snprintf(buf, 64, "%d", heater_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
306 pay = xstrcat(pay, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
307 pay = xstrcat(pay, (char *)"}}}");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
308 mqtt_publish(topic, pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
309 free(pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
310 pay = NULL;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
311 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
312
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
313 if (cooler_state >= 0) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
314 syslog(LOG_NOTICE, "Set fermenter %s/%s cooler %d", node, alias, cooler_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
315 pay = fermenter_paybase();
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
316 pay = xstrcat(pay, (char *)"{\"cooler\":{\"state\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
317 snprintf(buf, 64, "%d", cooler_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
318 pay = xstrcat(pay, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
319 pay = xstrcat(pay, (char *)"}}}");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
320 mqtt_publish(topic, pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
321 free(pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
322 pay = NULL;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
323 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
324
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
325 if (fan_state >= 0) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
326 syslog(LOG_NOTICE, "Set fermenter %s/%s fan %d", node, alias, fan_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
327 pay = fermenter_paybase();
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
328 pay = xstrcat(pay, (char *)"{\"fan\":{\"state\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
329 snprintf(buf, 64, "%d", fan_state);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
330 pay = xstrcat(pay, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
331 pay = xstrcat(pay, (char *)"}}}");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
332 mqtt_publish(topic, pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
333 free(pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
334 pay = NULL;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
335 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
336
698
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
337 if (light_state >= 0) {
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
338 syslog(LOG_NOTICE, "Set fermenter %s/%s light %d", node, alias, light_state);
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
339 pay = fermenter_paybase();
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
340 pay = xstrcat(pay, (char *)"{\"light\":{\"state\":");
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
341 snprintf(buf, 64, "%d", light_state);
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
342 pay = xstrcat(pay, buf);
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
343 pay = xstrcat(pay, (char *)"}}}");
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
344 mqtt_publish(topic, pay);
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
345 free(pay);
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
346 pay = NULL;
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
347 }
c7b4cb53b37c Fixed missing light_state commands for the webcam.
Michiel Broek <mbroek@mbse.eu>
parents: 686
diff changeset
348
679
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
349 if (beeruuid && beercode && beername && (yeast_hi > yeast_lo) && (yeast_lo > 0)) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
350 syslog(LOG_NOTICE, "Set fermenter %s/%s beer %s %s", node, alias, beercode, beername);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
351 pay = fermenter_paybase();
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
352 pay = xstrcat(pay, (char *)"{\"product\":{\"uuid\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
353 pay = xstrcat(pay, beeruuid);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
354 pay = xstrcat(pay, (char *)"\",\"code\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
355 pay = xstrcat(pay, beercode);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
356 pay = xstrcat(pay, (char *)"\",\"name\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
357 pay = xstrcat(pay, beername);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
358 pay = xstrcat(pay, (char *)"\",\"yeast_lo\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
359 snprintf(buf, 64, "%.1f", yeast_lo);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
360 pay = xstrcat(pay, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
361 pay = xstrcat(pay, (char *)",\"yeast_hi\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
362 snprintf(buf, 64, "%.1f", yeast_hi);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
363 pay = xstrcat(pay, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
364 pay = xstrcat(pay, (char *)"}}}");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
365 mqtt_publish(topic, pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
366 free(pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
367 pay = NULL;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
368 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
369
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
370 if (profile) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
371 syslog(LOG_NOTICE, "%s", profile);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
372 if (strcmp(profile, (char *)"null") == 0) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
373 syslog(LOG_NOTICE, "Set fermenter %s/%s profile null", node, alias);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
374 pay = fermenter_paybase();
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
375 pay = xstrcat(pay, (char *)"{\"profile\":null}}");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
376 mqtt_publish(topic, pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
377 free(pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
378 pay = NULL;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
379 } else if (profile_uuid && profile_name && profile_steps) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
380 syslog(LOG_NOTICE, "Set fermenter %s/%s profile %s", node, alias, profile_name);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
381 pay = fermenter_paybase();
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
382 pay = xstrcat(pay, (char *)"{\"profile\":{\"uuid\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
383 pay = xstrcat(pay, profile_uuid);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
384 pay = xstrcat(pay, (char *)"\",\"name\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
385 pay = xstrcat(pay, profile_name);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
386 pay = xstrcat(pay, (char *)"\",\"inittemp\":{\"low\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
387 snprintf(buf, 64, "%.1f", inittemp_lo);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
388 pay = xstrcat(pay, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
389 pay = xstrcat(pay, (char *)",\"high\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
390 snprintf(buf, 64, "%.1f", inittemp_hi);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
391 pay = xstrcat(pay, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
392 pay = xstrcat(pay, (char *)"},\"fridgemode\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
393 snprintf(buf, 64, "%d", profile_fridgemode);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
394 pay = xstrcat(pay, buf);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
395 pay = xstrcat(pay, (char *)",\"steps\":");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
396 pay = xstrcat(pay, profile_steps);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
397 pay = xstrcat(pay, (char *)"}}}");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
398 mqtt_publish(topic, pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
399 free(pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
400 pay = NULL;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
401 } else if (profile_command) {
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
402 syslog(LOG_NOTICE, "Set fermenter %s/%s profile command %s", node, alias, profile_command);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
403 pay = fermenter_paybase();
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
404 pay = xstrcat(pay, (char *)"{\"profile\":{\"command\":\"");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
405 pay = xstrcat(pay, profile_command);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
406 pay = xstrcat(pay, (char *)"\"}}}");
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
407 mqtt_publish(topic, pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
408 free(pay);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
409 pay = NULL;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
410 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
411 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
412 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
413
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
414 free(topic);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
415 if (node)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
416 free(node);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
417 if (alias)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
418 free(alias);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
419 if (beeruuid)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
420 free(beeruuid);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
421 if (beercode)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
422 free(beercode);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
423 if (beername)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
424 free(beername);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
425 if (mode)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
426 free(mode);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
427 if (stage)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
428 free(stage);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
429 if (profile)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
430 free(profile);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
431 if (profile_uuid)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
432 free(profile_uuid);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
433 if (profile_name)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
434 free(profile_name);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
435 if (profile_steps)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
436 free(profile_steps);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
437 if (profile_command)
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
438 free(profile_command);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
439 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
440
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
441
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
442
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
443 void fermenter_set(char *edge_node, char *alias, bool birth, char *payload)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
444 {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
445 struct json_object *jobj, *val, *sensor, *temp;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
446 sys_fermenter_list *fermenter, *tmpp;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
447 bool new_fermenter = true;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
448
679
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
449 //syslog(LOG_NOTICE, "fermenter_set: %s/%s %s %s", edge_node, alias, birth ? "BIRTH":"DATA", payload);
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
450
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
451 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
452 * Search fermenter record in the memory array and use it if found.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
453 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
454 if (fermenters) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
455 for (tmpp = fermenters; tmpp; tmpp = tmpp->next) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
456 if ((strcmp(tmpp->alias, alias) == 0) && (strcmp(tmpp->node, edge_node) == 0)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
457 new_fermenter = false;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
458 fermenter = tmpp;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
459 break;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
460 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
461 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
462 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
463
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
464 if (! birth && new_fermenter) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
465 printf("ERROR got DDATA and fermenter %s/%s doesn't exist\n", edge_node, alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
466 return;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
467 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
468 //printf("new_fermenter %s\n", new_fermenter ? "true":"false");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
469
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
470 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
471 * Allocate new fermenter if not yet known.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
472 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
473 if (new_fermenter) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
474 fermenter = (sys_fermenter_list *)malloc(sizeof(sys_fermenter_list));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
475 memset(fermenter, 0, sizeof(sys_fermenter_list));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
476 fermenter->alias = xstrcpy(alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
477 fermenter->node = xstrcpy(edge_node);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
478 fermenter->mode = xstrcpy((char *)"OFF");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
479 fermenter->stage = xstrcpy((char *)"PRIMARY");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
480 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
481
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
482 fermenter->online = true;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
483 if (birth) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
484 syslog(LOG_NOTICE, "Online fermenter %s/%s mode %s", edge_node, alias, fermenter->mode);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
485 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
486
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
487 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
488 * Process the JSON formatted payload.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
489 * Update only the fields that are found in the payload.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
490 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
491 jobj = json_tokener_parse(payload);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
492
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
493 if (json_object_object_get_ex(jobj, "uuid", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
494 if (fermenter->uuid)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
495 free(fermenter->uuid);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
496 fermenter->uuid = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
497 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
498 if (json_object_object_get_ex(jobj, "mode", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
499 if (fermenter->mode) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
500 if (strcmp(fermenter->mode, (char *)json_object_get_string(val))) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
501 syslog(LOG_NOTICE, "Change mode fermenter %s/%s: %s to %s", edge_node, alias, fermenter->mode, (char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
502 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
503 free(fermenter->mode);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
504 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
505 fermenter->mode = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
506 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
507 if (json_object_object_get_ex(jobj, "stage", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
508 if (fermenter->stage) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
509 if (strcmp(fermenter->stage, (char *)json_object_get_string(val))) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
510 syslog(LOG_NOTICE, "Change stage fermenter %s/%s: %s to %s", edge_node, alias, fermenter->stage, (char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
511 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
512 free(fermenter->stage);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
513 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
514 fermenter->stage = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
515 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
516 if (json_object_object_get_ex(jobj, "alarm", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
517 if (fermenter->alarm != json_object_get_int(val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
518 syslog(LOG_NOTICE, "Change alarm fermenter %s/%s: %d to %d", edge_node, alias, fermenter->alarm, json_object_get_int(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
519 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
520 fermenter->alarm = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
521 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
522 if (json_object_object_get_ex(jobj, "product", &sensor)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
523 if (json_object_object_get_ex(sensor, "code", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
524 if (fermenter->beercode)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
525 free(fermenter->beercode);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
526 fermenter->beercode = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
527 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
528 if (json_object_object_get_ex(sensor, "name", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
529 if (fermenter->beername)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
530 free(fermenter->beername);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
531 fermenter->beername = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
532 }
192
7f69b43e6084 Implemented beer uuid product in monitor fermenters.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
533 if (json_object_object_get_ex(sensor, "uuid", &val)) {
7f69b43e6084 Implemented beer uuid product in monitor fermenters.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
534 if (fermenter->beeruuid)
7f69b43e6084 Implemented beer uuid product in monitor fermenters.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
535 free(fermenter->beeruuid);
7f69b43e6084 Implemented beer uuid product in monitor fermenters.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
536 fermenter->beeruuid = xstrcpy((char *)json_object_get_string(val));
7f69b43e6084 Implemented beer uuid product in monitor fermenters.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
537 }
299
047ead629d4a Accept yeast temperature limits from thermferm via MQTT. Send yeat temperature ranges to thermferm together with the beer parameters. Store yeast temperature limits in the mon_fermenters database table. The monitor fermenters screen adjusts the temperature color ranges.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
538 if (json_object_object_get_ex(sensor, "yeast_lo", &val)) {
047ead629d4a Accept yeast temperature limits from thermferm via MQTT. Send yeat temperature ranges to thermferm together with the beer parameters. Store yeast temperature limits in the mon_fermenters database table. The monitor fermenters screen adjusts the temperature color ranges.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
539 fermenter->yeast_lo = json_object_get_double(val);
047ead629d4a Accept yeast temperature limits from thermferm via MQTT. Send yeat temperature ranges to thermferm together with the beer parameters. Store yeast temperature limits in the mon_fermenters database table. The monitor fermenters screen adjusts the temperature color ranges.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
540 }
047ead629d4a Accept yeast temperature limits from thermferm via MQTT. Send yeat temperature ranges to thermferm together with the beer parameters. Store yeast temperature limits in the mon_fermenters database table. The monitor fermenters screen adjusts the temperature color ranges.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
541 if (json_object_object_get_ex(sensor, "yeast_hi", &val)) {
047ead629d4a Accept yeast temperature limits from thermferm via MQTT. Send yeat temperature ranges to thermferm together with the beer parameters. Store yeast temperature limits in the mon_fermenters database table. The monitor fermenters screen adjusts the temperature color ranges.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
542 fermenter->yeast_hi = json_object_get_double(val);
047ead629d4a Accept yeast temperature limits from thermferm via MQTT. Send yeat temperature ranges to thermferm together with the beer parameters. Store yeast temperature limits in the mon_fermenters database table. The monitor fermenters screen adjusts the temperature color ranges.
Michiel Broek <mbroek@mbse.eu>
parents: 194
diff changeset
543 }
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
544 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
545 if (json_object_object_get_ex(jobj, "air", &sensor)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
546 if (json_object_object_get_ex(sensor, "address", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
547 if (fermenter->air_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
548 free(fermenter->air_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
549 fermenter->air_address= xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
550 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
551 if (json_object_object_get_ex(sensor, "state", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
552 if (fermenter->air_state)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
553 free(fermenter->air_state);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
554 fermenter->air_state= xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
555 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
556 if (json_object_object_get_ex(sensor, "temperature", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
557 fermenter->air_temperature = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
558 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
559 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
560 if (json_object_object_get_ex(jobj, "beer", &sensor)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
561 if (json_object_object_get_ex(sensor, "address", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
562 if (fermenter->beer_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
563 free(fermenter->beer_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
564 fermenter->beer_address= xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
565 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
566 if (json_object_object_get_ex(sensor, "state", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
567 if (fermenter->beer_state)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
568 free(fermenter->beer_state);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
569 fermenter->beer_state= xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
570 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
571 if (json_object_object_get_ex(sensor, "temperature", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
572 fermenter->beer_temperature = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
573 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
574 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
575 if (json_object_object_get_ex(jobj, "chiller", &sensor)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
576 if (json_object_object_get_ex(sensor, "address", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
577 if (fermenter->chiller_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
578 free(fermenter->chiller_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
579 fermenter->chiller_address= xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
580 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
581 if (json_object_object_get_ex(sensor, "state", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
582 if (fermenter->chiller_state)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
583 free(fermenter->chiller_state);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
584 fermenter->chiller_state= xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
585 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
586 if (json_object_object_get_ex(sensor, "temperature", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
587 fermenter->chiller_temperature = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
588 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
589 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
590 if (json_object_object_get_ex(jobj, "heater", &sensor)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
591 if (json_object_object_get_ex(sensor, "address", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
592 if (fermenter->heater_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
593 free(fermenter->heater_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
594 fermenter->heater_address= xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
595 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
596 if (json_object_object_get_ex(sensor, "state", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
597 fermenter->heater_state = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
598 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
599 if (json_object_object_get_ex(sensor, "usage", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
600 fermenter->heater_usage = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
601 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
602 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
603 if (json_object_object_get_ex(jobj, "cooler", &sensor)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
604 if (json_object_object_get_ex(sensor, "address", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
605 if (fermenter->cooler_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
606 free(fermenter->cooler_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
607 fermenter->cooler_address= xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
608 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
609 if (json_object_object_get_ex(sensor, "state", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
610 fermenter->cooler_state = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
611 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
612 if (json_object_object_get_ex(sensor, "usage", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
613 fermenter->cooler_usage = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
614 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
615 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
616 if (json_object_object_get_ex(jobj, "fan", &sensor)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
617 if (json_object_object_get_ex(sensor, "address", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
618 if (fermenter->fan_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
619 free(fermenter->fan_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
620 fermenter->fan_address= xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
621 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
622 if (json_object_object_get_ex(sensor, "state", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
623 fermenter->fan_state = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
624 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
625 if (json_object_object_get_ex(sensor, "usage", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
626 fermenter->fan_usage = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
627 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
628 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
629 if (json_object_object_get_ex(jobj, "light", &sensor)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
630 if (json_object_object_get_ex(sensor, "address", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
631 if (fermenter->light_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
632 free(fermenter->light_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
633 fermenter->light_address= xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
634 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
635 if (json_object_object_get_ex(sensor, "state", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
636 fermenter->light_state = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
637 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
638 if (json_object_object_get_ex(sensor, "usage", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
639 fermenter->light_usage = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
640 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
641 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
642 if (json_object_object_get_ex(jobj, "door", &sensor)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
643 if (json_object_object_get_ex(sensor, "address", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
644 if (fermenter->door_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
645 free(fermenter->door_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
646 fermenter->door_address= xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
647 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
648 if (json_object_object_get_ex(sensor, "state", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
649 fermenter->door_state = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
650 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
651 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
652 if (json_object_object_get_ex(jobj, "psu", &sensor)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
653 if (json_object_object_get_ex(sensor, "address", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
654 if (fermenter->psu_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
655 free(fermenter->psu_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
656 fermenter->psu_address= xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
657 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
658 if (json_object_object_get_ex(sensor, "state", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
659 fermenter->psu_state = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
660 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
661 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
662 if (json_object_object_get_ex(jobj, "setpoint", &sensor)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
663 if (json_object_object_get_ex(sensor, "low", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
664 fermenter->setpoint_low = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
665 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
666 if (json_object_object_get_ex(sensor, "high", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
667 fermenter->setpoint_high = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
668 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
669 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
670 if (json_object_object_get_ex(jobj, "profile", &sensor)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
671 if (strcmp(json_object_to_json_string_ext(sensor, 0), "null")) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
672 if (json_object_object_get_ex(sensor, "uuid", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
673 if (fermenter->profile_uuid)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
674 free(fermenter->profile_uuid);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
675 fermenter->profile_uuid = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
676 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
677 if (json_object_object_get_ex(sensor, "name", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
678 if (fermenter->profile_name)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
679 free(fermenter->profile_name);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
680 fermenter->profile_name = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
681 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
682 if (json_object_object_get_ex(sensor, "state", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
683 if (fermenter->profile_state)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
684 free(fermenter->profile_state);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
685 fermenter->profile_state = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
686 }
189
6470e5c6a001 In bmsd added missing json percent. The Makefile didn't install the fpdf library. Added profile commands. Small changes to the monitor fermenters screen. The monitor fermenters scheduler is now more responsive. Profiles selection and commands in the remote thermferm.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
687 if (json_object_object_get_ex(sensor, "percent", &val)) {
6470e5c6a001 In bmsd added missing json percent. The Makefile didn't install the fpdf library. Added profile commands. Small changes to the monitor fermenters screen. The monitor fermenters scheduler is now more responsive. Profiles selection and commands in the remote thermferm.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
688 fermenter->profile_percent = json_object_get_int(val);
6470e5c6a001 In bmsd added missing json percent. The Makefile didn't install the fpdf library. Added profile commands. Small changes to the monitor fermenters screen. The monitor fermenters scheduler is now more responsive. Profiles selection and commands in the remote thermferm.
Michiel Broek <mbroek@mbse.eu>
parents: 0
diff changeset
689 }
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
690 if (json_object_object_get_ex(sensor, "inittemp", &temp)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
691 if (json_object_object_get_ex(temp, "low", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
692 fermenter->profile_inittemp_low = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
693 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
694 if (json_object_object_get_ex(temp, "high", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
695 fermenter->profile_inittemp_high = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
696 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
697 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
698 if (json_object_object_get_ex(sensor, "steps", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
699 if (fermenter->profile_steps)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
700 free(fermenter->profile_steps);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
701 fermenter->profile_steps = xstrcpy((char *)json_object_to_json_string_ext(val, 0));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
702 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
703
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
704
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
705 } else {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
706 if (fermenter->profile_uuid)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
707 free(fermenter->profile_uuid);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
708 if (fermenter->profile_name)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
709 free(fermenter->profile_name);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
710 if (fermenter->profile_state)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
711 free(fermenter->profile_state);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
712 if (fermenter->profile_steps)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
713 free(fermenter->profile_steps);
705
d77b723f7b35 Make sure enumerated values are not empty in database updates. On several data queries set the database connection to UTF-8.
Michiel Broek <mbroek@mbse.eu>
parents: 698
diff changeset
714 fermenter->profile_uuid = fermenter->profile_name = fermenter->profile_steps = NULL;
d77b723f7b35 Make sure enumerated values are not empty in database updates. On several data queries set the database connection to UTF-8.
Michiel Broek <mbroek@mbse.eu>
parents: 698
diff changeset
715 fermenter->profile_state = xstrcpy((char *)"OFF");
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
716 fermenter->profile_percent = 0;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
717 fermenter->profile_inittemp_high = fermenter->profile_inittemp_low = 0.0;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
718 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
719 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
720 json_object_put(jobj);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
721
679
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
722 fermenter_ws_send(fermenter);
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
723 // fermenter_dump(fermenter);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
724
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
725 if (new_fermenter) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
726 if (fermenters == NULL) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
727 fermenters = fermenter;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
728 } else {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
729 for (tmpp = fermenters; tmpp; tmpp = tmpp->next) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
730 if (tmpp->next == NULL) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
731 tmpp->next = fermenter;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
732 break;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
733 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
734 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
735 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
736 fermenter_mysql_insert(fermenter);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
737 } else {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
738 fermenter_mysql_update(fermenter);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
739 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
740 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
741
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
742
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
743
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
744 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
745 * With DBIRTH all active fermenters are publishd in an array.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
746 * With DDATA only one fermenter is published in the payload.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
747 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
748 void fermenter_birth_data(char *topic, char *payload)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
749 {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
750 char *message_type, *edge_node, *alias;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
751 struct json_object *jobj, *val, *metric, *units, *unit;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
752 int arraylen;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
753
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
754 strtok(topic, "/"); // ignore namespace
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
755 strtok(NULL, "/");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
756 message_type = strtok(NULL, "/");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
757 edge_node = strtok(NULL, "/\0");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
758 alias = strtok(NULL, "/\0");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
759
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
760 if ((alias == NULL) && (strcmp("DBIRTH", message_type) == 0)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
761 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
762 * Global initial DBIRTH message with array of fermenters.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
763 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
764 jobj = json_tokener_parse(payload);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
765
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
766 if (json_object_object_get_ex(jobj, "metric", &metric)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
767 if (json_object_object_get_ex(metric, "units", &units)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
768 arraylen = json_object_array_length(units);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
769 for (int i = 0; i < arraylen; i++) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
770 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
771 * Parse the array of units
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
772 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
773 unit = json_object_array_get_idx(units, i);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
774
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
775 if (json_object_object_get_ex(unit, "alias", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
776 if (alias)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
777 free(alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
778 alias = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
779 fermenter_set(edge_node, alias, true, (char *)json_object_to_json_string_ext(unit, 0));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
780 free(alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
781 alias = NULL;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
782 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
783 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
784 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
785 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
786 json_object_put(jobj);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
787 return;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
788 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
789
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
790 if (strcmp("DBIRTH", message_type) == 0) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
791 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
792 * DBIRTH for just one fermenter.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
793 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
794 jobj = json_tokener_parse(payload);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
795
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
796 if (json_object_object_get_ex(jobj, "metric", &metric)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
797 fermenter_set(edge_node, alias, true, (char *)json_object_to_json_string_ext(metric, 0));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
798 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
799 json_object_put(jobj);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
800 return;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
801 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
802
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
803 if (strcmp("DDATA", message_type) == 0) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
804 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
805 * DDATA update messages for each fermenter.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
806 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
807 jobj = json_tokener_parse(payload);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
808
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
809 if (json_object_object_get_ex(jobj, "metric", &metric)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
810 fermenter_set(edge_node, alias, false, (char *)json_object_to_json_string_ext(metric, 0));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
811 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
812 json_object_put(jobj);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
813 return;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
814 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
815
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
816 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
817 * The rest are errors.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
818 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
819 printf("ERROR fermenter_birth_data: %s %s %s\n", message_type, edge_node, alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
820 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
821
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
822
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
823
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
824 void fermenter_log(char *topic, char *payload)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
825 {
194
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
826 char *edge_node, *alias, *line, buf[65], *logfile;
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
827 struct json_object *jobj, *val, *metric, *metric2;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
828 fermentation_log *log;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
829 struct tm *mytime;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
830 time_t timestamp;
194
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
831 FILE *fp;
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
832
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
833 strtok(topic, "/"); // ignore namespace
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
834 strtok(NULL, "/"); // group_id
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
835 strtok(NULL, "/"); // message_type
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
836 edge_node = strtok(NULL, "/\0");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
837 alias = strtok(NULL, "/\0");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
838
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
839 log = (fermentation_log *)malloc(sizeof(fermentation_log));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
840 memset(log, 0, sizeof(fermentation_log));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
841
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
842 log->fermenter_node = xstrcpy(edge_node);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
843 log->fermenter_alias = xstrcpy(alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
844 jobj = json_tokener_parse(payload);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
845
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
846 if (json_object_object_get_ex(jobj, "timestamp", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
847 timestamp = json_object_get_int(val);
558
a8e065a9f851 Another attempt to fix the MySQL server has gone away error. Fixed gcc 7.1+ compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 299
diff changeset
848 log->datetime = malloc(73);
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
849 mytime = localtime(&timestamp);
558
a8e065a9f851 Another attempt to fix the MySQL server has gone away error. Fixed gcc 7.1+ compiler warnings.
Michiel Broek <mbroek@mbse.eu>
parents: 299
diff changeset
850 snprintf(log->datetime, 73, "%04d-%02d-%02d %02d:%02d:%02d",
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
851 mytime->tm_year + 1900, mytime->tm_mon + 1, mytime->tm_mday, mytime->tm_hour, mytime->tm_min, mytime->tm_sec);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
852 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
853
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
854 if (json_object_object_get_ex(jobj, "metric", &metric)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
855
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
856 if (json_object_object_get_ex(metric, "product", &metric2)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
857 if (json_object_object_get_ex(metric2, "uuid", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
858 if (strcmp((char *)"(null)", json_object_get_string(val)))
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
859 log->product_uuid = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
860 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
861 if (json_object_object_get_ex(metric2, "code", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
862 if (strcmp((char *)"(null)", json_object_get_string(val)))
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
863 log->product_code = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
864 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
865 if (json_object_object_get_ex(metric2, "name", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
866 if (strcmp((char *)"(null)", json_object_get_string(val)))
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
867 log->product_name = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
868 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
869 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
870 if (json_object_object_get_ex(metric, "stage", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
871 log->stage = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
872 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
873 if (json_object_object_get_ex(metric, "mode", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
874 log->mode = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
875 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
876 if (json_object_object_get_ex(metric, "event", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
877 if (strcmp((char *)"(null)", json_object_get_string(val)))
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
878 log->event = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
879 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
880 if (json_object_object_get_ex(metric, "fermenter_uuid", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
881 if (strcmp((char *)"(null)", json_object_get_string(val)))
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
882 log->fermenter_uuid = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
883 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
884 if (json_object_object_get_ex(metric, "temperature", &metric2)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
885 if (json_object_object_get_ex(metric2, "air", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
886 log->temperature_air = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
887 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
888 if (json_object_object_get_ex(metric2, "beer", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
889 log->temperature_beer = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
890 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
891 if (json_object_object_get_ex(metric2, "chiller", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
892 log->temperature_chiller = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
893 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
894 if (json_object_object_get_ex(metric2, "room", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
895 log->temperature_room = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
896 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
897 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
898 if (json_object_object_get_ex(metric, "setpoint", &metric2)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
899 if (json_object_object_get_ex(metric2, "low", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
900 log->setpoint_low = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
901 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
902 if (json_object_object_get_ex(metric2, "high", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
903 log->setpoint_high = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
904 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
905 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
906 if (json_object_object_get_ex(metric, "heater", &metric2)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
907 if (json_object_object_get_ex(metric2, "power", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
908 log->heater_power = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
909 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
910 if (json_object_object_get_ex(metric2, "usage", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
911 log->heater_usage = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
912 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
913 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
914 if (json_object_object_get_ex(metric, "cooler", &metric2)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
915 if (json_object_object_get_ex(metric2, "power", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
916 log->cooler_power = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
917 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
918 if (json_object_object_get_ex(metric2, "usage", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
919 log->cooler_usage = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
920 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
921 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
922 if (json_object_object_get_ex(metric, "fan", &metric2)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
923 if (json_object_object_get_ex(metric2, "power", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
924 log->fan_power = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
925 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
926 if (json_object_object_get_ex(metric2, "usage", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
927 log->fan_usage = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
928 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
929 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
930 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
931 json_object_put(jobj);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
932
194
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
933 /*
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
934 * Build csv log line
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
935 */
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
936 line = xstrcpy(log->datetime);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
937 line = xstrcat(line, (char *)",");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
938 line = xstrcat(line, log->mode);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
939 line = xstrcat(line, (char *)",");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
940 line = xstrcat(line, log->stage);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
941 line = xstrcat(line, (char *)",");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
942 snprintf(buf, 64, "%.3f", log->temperature_air);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
943 line = xstrcat(line, buf);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
944 line = xstrcat(line, (char *)",");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
945 snprintf(buf, 64, "%.3f", log->temperature_beer);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
946 line = xstrcat(line, buf);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
947 line = xstrcat(line, (char *)",");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
948 snprintf(buf, 64, "%.3f", log->temperature_chiller);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
949 line = xstrcat(line, buf);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
950 line = xstrcat(line, (char *)",");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
951 snprintf(buf, 64, "%.3f", log->temperature_room);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
952 line = xstrcat(line, buf);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
953 line = xstrcat(line, (char *)",");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
954 snprintf(buf, 64, "%.1f", log->setpoint_low);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
955 line = xstrcat(line, buf);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
956 line = xstrcat(line, (char *)",");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
957 snprintf(buf, 64, "%.1f", log->setpoint_high);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
958 line = xstrcat(line, buf);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
959 line = xstrcat(line, (char *)",");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
960 snprintf(buf, 64, "%d", log->heater_power);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
961 line = xstrcat(line, buf);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
962 line = xstrcat(line, (char *)",");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
963 snprintf(buf, 64, "%ld", log->heater_usage);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
964 line = xstrcat(line, buf);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
965 line = xstrcat(line, (char *)",");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
966 snprintf(buf, 64, "%d", log->cooler_power);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
967 line = xstrcat(line, buf);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
968 line = xstrcat(line, (char *)",");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
969 snprintf(buf, 64, "%ld", log->cooler_usage);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
970 line = xstrcat(line, buf);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
971 line = xstrcat(line, (char *)",");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
972 if (log->event)
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
973 line = xstrcat(line, log->event);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
974 line = xstrcat(line, (char *)",");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
975 if (log->fermenter_uuid)
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
976 line = xstrcat(line, log->fermenter_uuid);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
977
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
978 /*
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
979 * Build logfile name
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
980 */
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
981 logfile = xstrcpy(Config.web_root);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
982 logfile = xstrcat(logfile, (char *)"/log/fermentation/");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
983 logfile = xstrcat(logfile, log->product_code);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
984 logfile = xstrcat(logfile, (char *)" ");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
985 logfile = xstrcat(logfile, log->product_name);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
986 logfile = xstrcat(logfile, (char *)".log");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
987
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
988 if (debug)
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
989 fprintf(stdout, "%s %s\n", logfile, line);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
990
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
991 fp = fopen(logfile, "a");
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
992 if (fp) {
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
993 fprintf(fp, "%s\n", line);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
994 fclose(fp);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
995 } else {
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
996 syslog(LOG_NOTICE, "cannot append to `%s'", logfile);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
997 }
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
998
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
999 free(logfile);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
1000 logfile = NULL;
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
1001 free(line);
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
1002 line = NULL;
d202777ebae5 Added design notes for the csv log format from fermenters. In bmsd configuration added the web_root entry. Switched fermenter DLOG messages to store the log in flat csv files instead of the database. This is much faster and the graphs look better.
Michiel Broek <mbroek@mbse.eu>
parents: 192
diff changeset
1003
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1004 if (log->datetime)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1005 free(log->datetime);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1006 if (log->product_uuid )
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1007 free(log->product_uuid );
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1008 if (log->product_code )
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1009 free(log->product_code );
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1010 if (log->product_name )
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1011 free(log->product_name );
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1012 if (log->stage)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1013 free(log->stage);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1014 if (log->mode)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1015 free(log->mode);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1016 if (log->event)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1017 free(log->event);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1018 if (log->fermenter_uuid)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1019 free(log->fermenter_uuid);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1020 if (log->fermenter_node)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1021 free(log->fermenter_node);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1022 if (log->fermenter_alias)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1023 free(log->fermenter_alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1024 free(log);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1025 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1026
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1027
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1028
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1029 void fermenter_dump(sys_fermenter_list *fermenter)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1030 {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1031 if (debug) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1032 printf("uuid %s\n", fermenter->uuid);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1033 printf("alias %s\n", fermenter->alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1034 printf("node %s\n", fermenter->node);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1035 printf("online %s\n", fermenter->online ? "yes":"no");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1036 printf("product %s / %s\n", fermenter->beercode, fermenter->beername);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1037 if (fermenter->air_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1038 printf("Air %-36s %10s %8.3f\n", fermenter->air_address, fermenter->air_state, fermenter->air_temperature);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1039 if (fermenter->beer_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1040 printf("Beer %-36s %10s %8.3f\n", fermenter->beer_address, fermenter->beer_state, fermenter->beer_temperature);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1041 if (fermenter->chiller_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1042 printf("Chiller %-36s %10s %8.3f\n", fermenter->chiller_address, fermenter->chiller_state, fermenter->chiller_temperature);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1043 if (fermenter->heater_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1044 printf("Heater %-36s %9d%% %8lu\n", fermenter->heater_address, fermenter->heater_state, fermenter->heater_usage);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1045 if (fermenter->cooler_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1046 printf("Cooler %-36s %9d%% %8lu\n", fermenter->cooler_address, fermenter->cooler_state, fermenter->cooler_usage);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1047 if (fermenter->fan_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1048 printf("Fan %-36s %9d%% %8lu\n", fermenter->fan_address, fermenter->fan_state, fermenter->fan_usage);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1049 if (fermenter->light_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1050 printf("Light %-36s %9d%% %8lu\n", fermenter->light_address, fermenter->light_state, fermenter->light_usage);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1051 if (fermenter->door_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1052 printf("Door %-36s %10d\n", fermenter->door_address, fermenter->door_state);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1053 if (fermenter->psu_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1054 printf("PSU %-36s %10d\n", fermenter->psu_address, fermenter->psu_state);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1055 printf("mode %s\n", fermenter->mode);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1056 printf("alarm %04x\n", fermenter->alarm);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1057 printf("sp high %8.3f\n", fermenter->setpoint_high);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1058 printf("sp low %8.3f\n", fermenter->setpoint_low);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1059 if (fermenter->profile_uuid) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1060 printf("profile uuid %s\n", fermenter->profile_uuid);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1061 printf("profile name %s\n", fermenter->profile_name);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1062 printf("profile state %s\n", fermenter->profile_state);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1063 printf("profile percent %d\n", fermenter->profile_percent);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1064 printf("profile sp high %.3f\n", fermenter->profile_inittemp_high);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1065 printf("profile sp low %.3f\n", fermenter->profile_inittemp_low);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1066 printf("profile steps %s\n", fermenter->profile_steps);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1067 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1068 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1069 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1070
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1071
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1072
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1073 void fermenter_death(char *topic)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1074 {
671
4b54d6f79d25 Version 0.3.33 Added websockets framework. Added fermenter status messages to the websockets broadcast.
Michiel Broek <mbroek@mbse.eu>
parents: 558
diff changeset
1075 char *edge_node, *alias, *msg = NULL;
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1076 sys_fermenter_list *tmpp;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1077
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1078 printf("fermenter_death: %s\n", topic);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1079 strtok(topic, "/"); // ignore namespace
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1080 strtok(NULL, "/"); // ignore group_id
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1081 strtok(NULL, "/"); // ignore message_type
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1082 edge_node = strtok(NULL, "/\0");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1083 alias = strtok(NULL, "/\0");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1084
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1085 fermenter_mysql_death(edge_node, alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1086
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1087 if (alias) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1088 for (tmpp = fermenters; tmpp; tmpp = tmpp->next) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1089 if ((strcmp(tmpp->node, edge_node) == 0) && (strcmp(tmpp->alias, alias) == 0)) {
674
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1090 if (tmpp->online) {
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1091 syslog(LOG_NOTICE, "Offline fermenter %s/%s", tmpp->node, tmpp->alias);
674
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1092 tmpp->online = false;
677
6e82fece1f8f Consistent use of group names is important.
Michiel Broek <mbroek@mbse.eu>
parents: 674
diff changeset
1093 msg = xstrcpy((char *)"{\"device\":\"fermenters\",\"node\":\"");
674
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1094 msg = xstrcat(msg, edge_node);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1095 msg = xstrcat(msg, (char *)"\",\"unit\":\"");
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1096 msg = xstrcat(msg, alias);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1097 msg = xstrcat(msg, (char *)"\",\"online\":0}");
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1098 ws_broadcast(msg);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1099 free(msg);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1100 msg = NULL;
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1101 }
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1102 break;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1103 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1104 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1105 } else {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1106 for (tmpp = fermenters; tmpp; tmpp = tmpp->next) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1107 if (strcmp(tmpp->node, edge_node) == 0) {
674
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1108 if (tmpp->online) {
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1109 syslog(LOG_NOTICE, "Offline fermenter %s/%s", tmpp->node, tmpp->alias);
674
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1110 tmpp->online = false;
677
6e82fece1f8f Consistent use of group names is important.
Michiel Broek <mbroek@mbse.eu>
parents: 674
diff changeset
1111 msg = xstrcpy((char *)"{\"device\":\"fermenters\",\"node\":\"");
674
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1112 msg = xstrcat(msg, edge_node);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1113 msg = xstrcat(msg, (char *)"\",\"unit\":\"");
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1114 msg = xstrcat(msg, tmpp->alias);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1115 msg = xstrcat(msg, (char *)"\",\"online\":0}");
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1116 ws_broadcast(msg);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1117 free(msg);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1118 msg = NULL;
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1119 }
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1120 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1121 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1122 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1123 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1124
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1125

mercurial