bmsd/fermenters.c

Thu, 21 May 2020 14:32:23 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 21 May 2020 14:32:23 +0200
changeset 686
ca1fbb3bd3db
parent 684
ccb9f24d0fe9
child 698
c7b4cb53b37c
permissions
-rw-r--r--

Removed ws_global function because dynamic menus don't work.

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;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
188 int heater_state = -1, cooler_state = -1, fan_state = -1, profile_fridgemode = -1;
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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);
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and the application does not handle these split messages. Needs termferm 0.9.9 or newer.
Michiel Broek <mbroek@mbse.eu>
parents: 677
diff changeset
224 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
225 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
226 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
227 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
228 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 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
230 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
231 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
232 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 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
234 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
235 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
236
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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(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
238 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
239 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
240 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
241 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 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
243 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
244 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
245 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
246 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
247 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
248 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
249 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 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
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 /*
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 * 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
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 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
257 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
258 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
259 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
260
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 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
262 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
263 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
264 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
265 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
266 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
267 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
268 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
269 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
270 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
271 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 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
274 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
275 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
276 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
277 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
278 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
279 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
280 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
281 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
282 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 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
285 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
286 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
287 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
288 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
289 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
290 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
291 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
292 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
293 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
294 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
295 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
296 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
297 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 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
300 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
301 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
302 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
303 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
304 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
305 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
306 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
307 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
308 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
309 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 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
312 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
313 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
314 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
315 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
316 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
317 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
318 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
319 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
320 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
321 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 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
324 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
325 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
326 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
327 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
328 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
329 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
330 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
331 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
332 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
333 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 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
336 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
337 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
338 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
339 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
340 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
341 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
342 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
343 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
344 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
345 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
346 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
347 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
348 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
349 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
350 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
351 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
352 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
353 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
354 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 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
357 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
358 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
359 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
360 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
361 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
362 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
363 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
364 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
365 } 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
366 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
367 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
368 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
369 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
370 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
371 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
372 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
373 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
374 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
375 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
376 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
377 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
378 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
379 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
380 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
381 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
382 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
383 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
384 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
385 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
386 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
387 } 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
388 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
389 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
390 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
391 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
392 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
393 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
394 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
395 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
396 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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 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
401 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
402 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
403 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
404 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
405 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
406 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
407 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
408 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
409 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
410 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
411 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
412 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
413 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
414 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
415 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
416 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
417 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
418 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
419 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
420 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
421 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
422 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
423 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
424 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
425 }
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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
48f8f3fce7c0 Added reconnecting-websocket.js to automatic reconnect the websocket if the connection is lost. Usefull for mobile devices that go to sleep after a while. Changed mon_fermenters to use websockets instead of polling. Fixed wrong temperature color ranges on the fermenter monior. Increased the websocket receive buffer to 2048. In cannot overflow, but larger messages are chunked and 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
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
428
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
429 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
430 {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
431 struct json_object *jobj, *val, *sensor, *temp;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
432 sys_fermenter_list *fermenter, *tmpp;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
433 bool new_fermenter = true;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
434
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
435 //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
436
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
437 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
438 * 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
439 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
440 if (fermenters) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
441 for (tmpp = fermenters; tmpp; tmpp = tmpp->next) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
442 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
443 new_fermenter = false;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
444 fermenter = tmpp;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
445 break;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
446 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
447 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
448 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
449
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
450 if (! birth && new_fermenter) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
451 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
452 return;
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 //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
455
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
456 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
457 * Allocate new fermenter if not yet known.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
458 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
459 if (new_fermenter) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
460 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
461 memset(fermenter, 0, sizeof(sys_fermenter_list));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
462 fermenter->alias = xstrcpy(alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
463 fermenter->node = xstrcpy(edge_node);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
464 fermenter->mode = xstrcpy((char *)"OFF");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
465 fermenter->stage = xstrcpy((char *)"PRIMARY");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
466 }
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 fermenter->online = true;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
469 if (birth) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
470 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
471 }
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 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
474 * Process the JSON formatted payload.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
475 * 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
476 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
477 jobj = json_tokener_parse(payload);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
478
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
479 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
480 if (fermenter->uuid)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
481 free(fermenter->uuid);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
482 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
483 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
484 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
485 if (fermenter->mode) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
486 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
487 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
488 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
489 free(fermenter->mode);
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 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
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, "stage", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
494 if (fermenter->stage) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
495 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
496 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
497 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
498 free(fermenter->stage);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
499 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
500 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
501 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
502 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
503 if (fermenter->alarm != json_object_get_int(val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
504 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
505 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
506 fermenter->alarm = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
507 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
508 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
509 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
510 if (fermenter->beercode)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
511 free(fermenter->beercode);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
512 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
513 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
514 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
515 if (fermenter->beername)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
516 free(fermenter->beername);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
517 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
518 }
192
7f69b43e6084 Implemented beer uuid product in monitor fermenters.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
519 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
520 if (fermenter->beeruuid)
7f69b43e6084 Implemented beer uuid product in monitor fermenters.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
521 free(fermenter->beeruuid);
7f69b43e6084 Implemented beer uuid product in monitor fermenters.
Michiel Broek <mbroek@mbse.eu>
parents: 189
diff changeset
522 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
523 }
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
524 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
525 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
526 }
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
527 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
528 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
529 }
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
530 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
531 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
532 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
533 if (fermenter->air_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
534 free(fermenter->air_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
535 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
536 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
537 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
538 if (fermenter->air_state)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
539 free(fermenter->air_state);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
540 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
541 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
542 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
543 fermenter->air_temperature = json_object_get_double(val);
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 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
546 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
547 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
548 if (fermenter->beer_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
549 free(fermenter->beer_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
550 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
551 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
552 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
553 if (fermenter->beer_state)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
554 free(fermenter->beer_state);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
555 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
556 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
557 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
558 fermenter->beer_temperature = json_object_get_double(val);
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 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
561 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
562 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
563 if (fermenter->chiller_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
564 free(fermenter->chiller_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
565 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
566 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
567 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
568 if (fermenter->chiller_state)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
569 free(fermenter->chiller_state);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
570 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
571 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
572 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
573 fermenter->chiller_temperature = json_object_get_double(val);
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 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
576 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
577 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
578 if (fermenter->heater_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
579 free(fermenter->heater_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
580 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
581 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
582 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
583 fermenter->heater_state = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
584 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
585 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
586 fermenter->heater_usage = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
587 }
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 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
590 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
591 if (fermenter->cooler_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
592 free(fermenter->cooler_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
593 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
594 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
595 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
596 fermenter->cooler_state = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
597 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
598 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
599 fermenter->cooler_usage = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
600 }
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 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
603 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
604 if (fermenter->fan_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
605 free(fermenter->fan_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
606 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
607 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
608 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
609 fermenter->fan_state = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
610 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
611 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
612 fermenter->fan_usage = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
613 }
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 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
616 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
617 if (fermenter->light_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
618 free(fermenter->light_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
619 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
620 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
621 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
622 fermenter->light_state = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
623 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
624 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
625 fermenter->light_usage = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
626 }
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 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
629 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
630 if (fermenter->door_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
631 free(fermenter->door_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
632 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
633 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
634 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
635 fermenter->door_state = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
636 }
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(jobj, "psu", &sensor)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
639 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
640 if (fermenter->psu_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
641 free(fermenter->psu_address);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
642 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
643 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
644 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
645 fermenter->psu_state = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
646 }
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(jobj, "setpoint", &sensor)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
649 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
650 fermenter->setpoint_low = json_object_get_double(val);
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(sensor, "high", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
653 fermenter->setpoint_high = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
654 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
655 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
656 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
657 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
658 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
659 if (fermenter->profile_uuid)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
660 free(fermenter->profile_uuid);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
661 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
662 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
663 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
664 if (fermenter->profile_name)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
665 free(fermenter->profile_name);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
666 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
667 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
668 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
669 if (fermenter->profile_state)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
670 free(fermenter->profile_state);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
671 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
672 }
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
673 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
674 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
675 }
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
676 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
677 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
678 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
679 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
680 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
681 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
682 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
683 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
684 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
685 if (fermenter->profile_steps)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
686 free(fermenter->profile_steps);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
687 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
688 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
689
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
690
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
691 } else {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
692 if (fermenter->profile_uuid)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
693 free(fermenter->profile_uuid);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
694 if (fermenter->profile_name)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
695 free(fermenter->profile_name);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
696 if (fermenter->profile_state)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
697 free(fermenter->profile_state);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
698 if (fermenter->profile_steps)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
699 free(fermenter->profile_steps);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
700 fermenter->profile_uuid = fermenter->profile_name = fermenter->profile_state = fermenter->profile_steps = NULL;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
701 fermenter->profile_percent = 0;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
702 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
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 json_object_put(jobj);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
706
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
707 fermenter_ws_send(fermenter);
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
708 // fermenter_dump(fermenter);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
709
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
710 if (new_fermenter) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
711 if (fermenters == NULL) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
712 fermenters = fermenter;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
713 } else {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
714 for (tmpp = fermenters; tmpp; tmpp = tmpp->next) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
715 if (tmpp->next == NULL) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
716 tmpp->next = fermenter;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
717 break;
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 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
721 fermenter_mysql_insert(fermenter);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
722 } else {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
723 fermenter_mysql_update(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 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
726
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
727
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
728
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
729 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
730 * 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
731 * 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
732 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
733 void fermenter_birth_data(char *topic, char *payload)
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 char *message_type, *edge_node, *alias;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
736 struct json_object *jobj, *val, *metric, *units, *unit;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
737 int arraylen;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
738
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
739 strtok(topic, "/"); // ignore namespace
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
740 strtok(NULL, "/");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
741 message_type = strtok(NULL, "/");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
742 edge_node = strtok(NULL, "/\0");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
743 alias = strtok(NULL, "/\0");
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 if ((alias == NULL) && (strcmp("DBIRTH", message_type) == 0)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
746 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
747 * Global initial DBIRTH message with array of fermenters.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
748 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
749 jobj = json_tokener_parse(payload);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
750
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
751 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
752 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
753 arraylen = json_object_array_length(units);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
754 for (int i = 0; i < arraylen; i++) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
755 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
756 * Parse the array of units
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
757 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
758 unit = json_object_array_get_idx(units, i);
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 (json_object_object_get_ex(unit, "alias", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
761 if (alias)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
762 free(alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
763 alias = xstrcpy((char *)json_object_get_string(val));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
764 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
765 free(alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
766 alias = NULL;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
767 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
768 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
769 }
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 json_object_put(jobj);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
772 return;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
773 }
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 (strcmp("DBIRTH", message_type) == 0) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
776 /*
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
777 * DBIRTH for just one fermenter.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
778 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
779 jobj = json_tokener_parse(payload);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
780
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
781 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
782 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
783 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
784 json_object_put(jobj);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
785 return;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
786 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
787
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
788 if (strcmp("DDATA", message_type) == 0) {
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 * DDATA update messages for each fermenter.
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 jobj = json_tokener_parse(payload);
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 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
795 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
796 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
797 json_object_put(jobj);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
798 return;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
799 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
800
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 * The rest are errors.
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
803 */
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
804 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
805 }
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
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 void fermenter_log(char *topic, char *payload)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
810 {
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
811 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
812 struct json_object *jobj, *val, *metric, *metric2;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
813 fermentation_log *log;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
814 struct tm *mytime;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
815 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
816 FILE *fp;
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
817
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
818 strtok(topic, "/"); // ignore namespace
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
819 strtok(NULL, "/"); // group_id
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
820 strtok(NULL, "/"); // message_type
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
821 edge_node = strtok(NULL, "/\0");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
822 alias = strtok(NULL, "/\0");
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 log = (fermentation_log *)malloc(sizeof(fermentation_log));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
825 memset(log, 0, sizeof(fermentation_log));
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
826
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
827 log->fermenter_node = xstrcpy(edge_node);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
828 log->fermenter_alias = xstrcpy(alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
829 jobj = json_tokener_parse(payload);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
830
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
831 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
832 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
833 log->datetime = malloc(73);
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
834 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
835 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
836 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
837 }
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 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
840
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
841 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
842 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
843 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
844 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
845 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
846 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
847 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
848 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
849 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
850 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
851 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
852 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
853 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
854 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
855 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
856 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
857 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
858 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
859 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
860 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
861 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
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->event = 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(metric, "fermenter_uuid", &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->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
868 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
869 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
870 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
871 log->temperature_air = json_object_get_double(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(metric2, "beer", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
874 log->temperature_beer = json_object_get_double(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(metric2, "chiller", &val)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
877 log->temperature_chiller = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
878 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
879 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
880 log->temperature_room = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
881 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
882 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
883 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
884 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
885 log->setpoint_low = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
886 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
887 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
888 log->setpoint_high = json_object_get_double(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
889 }
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(metric, "heater", &metric2)) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
892 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
893 log->heater_power = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
894 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
895 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
896 log->heater_usage = json_object_get_int(val);
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 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
899 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
900 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
901 log->cooler_power = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
902 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
903 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
904 log->cooler_usage = json_object_get_int(val);
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 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
907 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
908 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
909 log->fan_power = json_object_get_int(val);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
910 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
911 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
912 log->fan_usage = json_object_get_int(val);
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 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
915 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
916 json_object_put(jobj);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
917
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
918 /*
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
919 * 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
920 */
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
921 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
922 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
923 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
924 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
925 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
926 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
927 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
928 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
929 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
930 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
931 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
932 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
933 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
934 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
935 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
936 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
937 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
938 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
939 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
940 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
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, "%.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
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, "%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
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, "%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
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, "%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
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, "%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
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 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
958 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
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 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
961 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
962
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 /*
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 * 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
965 */
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 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
967 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
968 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
969 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
970 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
971 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
972
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 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
974 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
975
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 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
977 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
978 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
979 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
980 } 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
981 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
982 }
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
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 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
985 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
986 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
987 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
988
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
989 if (log->datetime)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
990 free(log->datetime);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
991 if (log->product_uuid )
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
992 free(log->product_uuid );
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
993 if (log->product_code )
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
994 free(log->product_code );
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
995 if (log->product_name )
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
996 free(log->product_name );
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
997 if (log->stage)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
998 free(log->stage);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
999 if (log->mode)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1000 free(log->mode);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1001 if (log->event)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1002 free(log->event);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1003 if (log->fermenter_uuid)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1004 free(log->fermenter_uuid);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1005 if (log->fermenter_node)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1006 free(log->fermenter_node);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1007 if (log->fermenter_alias)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1008 free(log->fermenter_alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1009 free(log);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1010 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1011
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1012
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1013
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1014 void fermenter_dump(sys_fermenter_list *fermenter)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1015 {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1016 if (debug) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1017 printf("uuid %s\n", fermenter->uuid);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1018 printf("alias %s\n", fermenter->alias);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1019 printf("node %s\n", fermenter->node);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1020 printf("online %s\n", fermenter->online ? "yes":"no");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1021 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
1022 if (fermenter->air_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1023 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
1024 if (fermenter->beer_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1025 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
1026 if (fermenter->chiller_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1027 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
1028 if (fermenter->heater_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1029 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
1030 if (fermenter->cooler_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1031 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
1032 if (fermenter->fan_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1033 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
1034 if (fermenter->light_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1035 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
1036 if (fermenter->door_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1037 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
1038 if (fermenter->psu_address)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1039 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
1040 printf("mode %s\n", fermenter->mode);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1041 printf("alarm %04x\n", fermenter->alarm);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1042 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
1043 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
1044 if (fermenter->profile_uuid) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1045 printf("profile uuid %s\n", fermenter->profile_uuid);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1046 printf("profile name %s\n", fermenter->profile_name);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1047 printf("profile state %s\n", fermenter->profile_state);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1048 printf("profile percent %d\n", fermenter->profile_percent);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1049 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
1050 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
1051 printf("profile steps %s\n", fermenter->profile_steps);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1052 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1053 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1054 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1055
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1056
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1057
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1058 void fermenter_death(char *topic)
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1059 {
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
1060 char *edge_node, *alias, *msg = NULL;
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1061 sys_fermenter_list *tmpp;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1062
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1063 printf("fermenter_death: %s\n", topic);
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1064 strtok(topic, "/"); // ignore namespace
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1065 strtok(NULL, "/"); // ignore group_id
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1066 strtok(NULL, "/"); // ignore message_type
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1067 edge_node = strtok(NULL, "/\0");
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1068 alias = strtok(NULL, "/\0");
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 fermenter_mysql_death(edge_node, alias);
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 if (alias) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1073 for (tmpp = fermenters; tmpp; tmpp = tmpp->next) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1074 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
1075 if (tmpp->online) {
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1076 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
1077 tmpp->online = false;
677
6e82fece1f8f Consistent use of group names is important.
Michiel Broek <mbroek@mbse.eu>
parents: 674
diff changeset
1078 msg = xstrcpy((char *)"{\"device\":\"fermenters\",\"node\":\"");
674
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1079 msg = xstrcat(msg, edge_node);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1080 msg = xstrcat(msg, (char *)"\",\"unit\":\"");
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1081 msg = xstrcat(msg, alias);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1082 msg = xstrcat(msg, (char *)"\",\"online\":0}");
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1083 ws_broadcast(msg);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1084 free(msg);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1085 msg = NULL;
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1086 }
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1087 break;
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1088 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1089 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1090 } else {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1091 for (tmpp = fermenters; tmpp; tmpp = tmpp->next) {
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1092 if (strcmp(tmpp->node, edge_node) == 0) {
674
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1093 if (tmpp->online) {
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1094 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
1095 tmpp->online = false;
677
6e82fece1f8f Consistent use of group names is important.
Michiel Broek <mbroek@mbse.eu>
parents: 674
diff changeset
1096 msg = xstrcpy((char *)"{\"device\":\"fermenters\",\"node\":\"");
674
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1097 msg = xstrcat(msg, edge_node);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1098 msg = xstrcat(msg, (char *)"\",\"unit\":\"");
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1099 msg = xstrcat(msg, tmpp->alias);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1100 msg = xstrcat(msg, (char *)"\",\"online\":0}");
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1101 ws_broadcast(msg);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1102 free(msg);
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1103 msg = NULL;
c865e3cdee04 Prevent repeated fermenter offline broadcasts
Michiel Broek <mbroek@mbse.eu>
parents: 671
diff changeset
1104 }
0
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1105 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1106 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1107 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1108 }
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1109
033898178630 Versio 0.0.2 initial check in
Michiel Broek <mbroek@mbse.eu>
parents:
diff changeset
1110

mercurial