1 /** |
1 /** |
2 * @file fermenters.c |
2 * @file fermenters.c |
3 * @brief Handle fermenters status |
3 * @brief Handle fermenters status |
4 * @author Michiel Broek <mbroek at mbse dot eu> |
4 * @author Michiel Broek <mbroek at mbse dot eu> |
5 * |
5 * |
6 * Copyright (C) 2018 |
6 * Copyright (C) 2018-2019 |
7 * |
7 * |
8 * This file is part of the bms (Brewery Management System) |
8 * This file is part of the bms (Brewery Management System) |
9 * |
9 * |
10 * This is free software; you can redistribute it and/or modify it |
10 * This is free software; you can redistribute it and/or modify it |
11 * under the terms of the GNU General Public License as published by the |
11 * under the terms of the GNU General Public License as published by the |
268 } |
268 } |
269 if (json_object_object_get_ex(sensor, "state", &val)) { |
269 if (json_object_object_get_ex(sensor, "state", &val)) { |
270 if (fermenter->profile_state) |
270 if (fermenter->profile_state) |
271 free(fermenter->profile_state); |
271 free(fermenter->profile_state); |
272 fermenter->profile_state = xstrcpy((char *)json_object_get_string(val)); |
272 fermenter->profile_state = xstrcpy((char *)json_object_get_string(val)); |
|
273 } |
|
274 if (json_object_object_get_ex(sensor, "percent", &val)) { |
|
275 fermenter->profile_percent = json_object_get_int(val); |
273 } |
276 } |
274 if (json_object_object_get_ex(sensor, "inittemp", &temp)) { |
277 if (json_object_object_get_ex(sensor, "inittemp", &temp)) { |
275 if (json_object_object_get_ex(temp, "low", &val)) { |
278 if (json_object_object_get_ex(temp, "low", &val)) { |
276 fermenter->profile_inittemp_low = json_object_get_double(val); |
279 fermenter->profile_inittemp_low = json_object_get_double(val); |
277 } |
280 } |