1001 srv_send((char *)"TEMP_STATE,%s", TEMPSTATE[Config.temp_state]); |
1001 srv_send((char *)"TEMP_STATE,%s", TEMPSTATE[Config.temp_state]); |
1002 srv_send((char *)"TEMP_VALUE,%.1f", Config.temp_value / 1000.0); |
1002 srv_send((char *)"TEMP_VALUE,%.1f", Config.temp_value / 1000.0); |
1003 srv_send((char *)"HUM_ADDRESS,%s", Config.hum_address); |
1003 srv_send((char *)"HUM_ADDRESS,%s", Config.hum_address); |
1004 srv_send((char *)"HUM_STATE,%s", TEMPSTATE[Config.hum_state]); |
1004 srv_send((char *)"HUM_STATE,%s", TEMPSTATE[Config.hum_state]); |
1005 srv_send((char *)"HUM_VALUE,%.0f", Config.hum_value / 1000.0); |
1005 srv_send((char *)"HUM_VALUE,%.0f", Config.hum_value / 1000.0); |
|
1006 srv_send((char *)"TEMP_HUM_IDX,%d", Config.temp_hum_idx); |
1006 srv_send((char *)"LCD_COLS,%d", Config.lcd_cols); |
1007 srv_send((char *)"LCD_COLS,%d", Config.lcd_cols); |
1007 srv_send((char *)"LCD_ROWS,%d", Config.lcd_rows); |
1008 srv_send((char *)"LCD_ROWS,%d", Config.lcd_rows); |
1008 srv_send((char *)"NEXT_UNIT,%d", Config.next_unit); |
1009 srv_send((char *)"NEXT_UNIT,%d", Config.next_unit); |
1009 #ifdef HAVE_MOSQUITTO_H |
1010 #ifdef HAVE_MOSQUITTO_H |
1010 srv_send((char *)"MQTT_HOST,%s", Config.mqtt_host); |
1011 srv_send((char *)"MQTT_HOST,%s", Config.mqtt_host); |
1075 if (val) { |
1076 if (val) { |
1076 Config.hum_address = xstrcpy(val); |
1077 Config.hum_address = xstrcpy(val); |
1077 device_count(TRUE, Config.hum_address); |
1078 device_count(TRUE, Config.hum_address); |
1078 } else |
1079 } else |
1079 Config.hum_address = NULL; |
1080 Config.hum_address = NULL; |
|
1081 |
|
1082 } else if (val && (strcmp(kwd, (char *)"TEMP_HUM_IDX") == 0)) { |
|
1083 if (sscanf(val, "%d", &ival) == 1) { |
|
1084 if (Config.temp_hum_idx != ival) |
|
1085 syslog(LOG_NOTICE, "Global Temp/Humidity idx %d to %d", Config.temp_hum_idx, ival); |
|
1086 Config.temp_hum_idx = ival; |
|
1087 } |
1080 |
1088 |
1081 } else if (val && (strcmp(kwd, (char *)"LCD_COLS") == 0)) { |
1089 } else if (val && (strcmp(kwd, (char *)"LCD_COLS") == 0)) { |
1082 if (sscanf(val, "%d", &ival) == 1) { |
1090 if (sscanf(val, "%d", &ival) == 1) { |
1083 if (Config.lcd_cols != ival) |
1091 if (Config.lcd_cols != ival) |
1084 syslog(LOG_NOTICE, "Global LCD columns %d to %d", Config.lcd_cols, ival); |
1092 syslog(LOG_NOTICE, "Global LCD columns %d to %d", Config.lcd_cols, ival); |
2002 unit->name = xstrcpy(param); |
2010 unit->name = xstrcpy(param); |
2003 unit->alias = xstrcpy(an); |
2011 unit->alias = xstrcpy(an); |
2004 unit->air_address = unit->beer_address = unit->heater_address = unit->cooler_address = \ |
2012 unit->air_address = unit->beer_address = unit->heater_address = unit->cooler_address = \ |
2005 unit->fan_address = unit->door_address = unit->light_address = \ |
2013 unit->fan_address = unit->door_address = unit->light_address = \ |
2006 unit->psu_address = unit->profile = NULL; |
2014 unit->psu_address = unit->profile = NULL; |
|
2015 unit->air_idx = unit->beer_idx = unit->heater_idx = unit->cooler_idx = unit->fan_idx = \ |
|
2016 unit->door_idx = unit->light_idx = unit->psu_idx = 0; |
2007 unit->volume = unit->prof_peak_abs = unit->prof_peak_rel = 0.0; |
2017 unit->volume = unit->prof_peak_abs = unit->prof_peak_rel = 0.0; |
2008 unit->air_state = unit->beer_state = 1; |
2018 unit->air_state = unit->beer_state = 1; |
2009 unit->air_temperature = unit->beer_temperature = 20000; |
2019 unit->air_temperature = unit->beer_temperature = 20000; |
2010 unit->beer_set = unit->fridge_set = 20.0; |
2020 unit->beer_set = unit->fridge_set = 20.0; |
2011 unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = \ |
2021 unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = \ |
2085 srv_send((char *)"ALIAS,%s", unit->alias); |
2095 srv_send((char *)"ALIAS,%s", unit->alias); |
2086 srv_send((char *)"VOLUME,%2f", unit->volume); |
2096 srv_send((char *)"VOLUME,%2f", unit->volume); |
2087 srv_send((char *)"AIR_ADDRESS,%s", unit->air_address); |
2097 srv_send((char *)"AIR_ADDRESS,%s", unit->air_address); |
2088 srv_send((char *)"AIR_STATE,%s", TEMPSTATE[unit->air_state]); |
2098 srv_send((char *)"AIR_STATE,%s", TEMPSTATE[unit->air_state]); |
2089 srv_send((char *)"AIR_TEMPERATURE,%.3f", unit->air_temperature / 1000.0); |
2099 srv_send((char *)"AIR_TEMPERATURE,%.3f", unit->air_temperature / 1000.0); |
|
2100 srv_send((char *)"AIR_IDX,%d", unit->air_idx); |
2090 srv_send((char *)"BEER_ADDRESS,%s", MBSE_SS(unit->beer_address)); |
2101 srv_send((char *)"BEER_ADDRESS,%s", MBSE_SS(unit->beer_address)); |
2091 srv_send((char *)"BEER_STATE,%s", TEMPSTATE[unit->beer_state]); |
2102 srv_send((char *)"BEER_STATE,%s", TEMPSTATE[unit->beer_state]); |
2092 srv_send((char *)"BEER_TEMPERATURE,%.3f", unit->beer_temperature / 1000.0); |
2103 srv_send((char *)"BEER_TEMPERATURE,%.3f", unit->beer_temperature / 1000.0); |
|
2104 srv_send((char *)"BEER_IDX,%d", unit->beer_idx); |
2093 srv_send((char *)"HEATER_ADDRESS,%s", unit->heater_address); |
2105 srv_send((char *)"HEATER_ADDRESS,%s", unit->heater_address); |
2094 srv_send((char *)"HEATER_STATE,%d", unit->heater_state); |
2106 srv_send((char *)"HEATER_STATE,%d", unit->heater_state); |
2095 srv_send((char *)"HEATER_DELAY,%d", unit->heater_delay); |
2107 srv_send((char *)"HEATER_DELAY,%d", unit->heater_delay); |
2096 srv_send((char *)"HEATER_USAGE,%d", unit->heater_usage); |
2108 srv_send((char *)"HEATER_USAGE,%d", unit->heater_usage); |
|
2109 srv_send((char *)"HEATER_IDX,%d", unit->heater_idx); |
2097 if (unit->PID_heat) { |
2110 if (unit->PID_heat) { |
2098 srv_send((char *)"PIDH_IMAX,%.1f", unit->PID_heat->iMax); |
2111 srv_send((char *)"PIDH_IMAX,%.1f", unit->PID_heat->iMax); |
2099 srv_send((char *)"PIDH_IDLERANGE,%.2f", unit->PID_heat->idleRange); |
2112 srv_send((char *)"PIDH_IDLERANGE,%.2f", unit->PID_heat->idleRange); |
2100 srv_send((char *)"PIDH_PGAIN,%.3f", unit->PID_heat->pGain); |
2113 srv_send((char *)"PIDH_PGAIN,%.3f", unit->PID_heat->pGain); |
2101 srv_send((char *)"PIDH_IGAIN,%.3f", unit->PID_heat->iGain); |
2114 srv_send((char *)"PIDH_IGAIN,%.3f", unit->PID_heat->iGain); |
2104 } |
2117 } |
2105 srv_send((char *)"COOLER_ADDRESS,%s", unit->cooler_address); |
2118 srv_send((char *)"COOLER_ADDRESS,%s", unit->cooler_address); |
2106 srv_send((char *)"COOLER_STATE,%d", unit->cooler_state); |
2119 srv_send((char *)"COOLER_STATE,%d", unit->cooler_state); |
2107 srv_send((char *)"COOLER_DELAY,%d", unit->cooler_delay); |
2120 srv_send((char *)"COOLER_DELAY,%d", unit->cooler_delay); |
2108 srv_send((char *)"COOLER_USAGE,%d", unit->cooler_usage); |
2121 srv_send((char *)"COOLER_USAGE,%d", unit->cooler_usage); |
|
2122 srv_send((char *)"COOLER_IDX,%d", unit->cooler_idx); |
2109 if (unit->PID_cool) { |
2123 if (unit->PID_cool) { |
2110 srv_send((char *)"PIDC_IMAX,%.1f", unit->PID_cool->iMax); |
2124 srv_send((char *)"PIDC_IMAX,%.1f", unit->PID_cool->iMax); |
2111 srv_send((char *)"PIDC_IDLERANGE,%.2f", unit->PID_cool->idleRange); |
2125 srv_send((char *)"PIDC_IDLERANGE,%.2f", unit->PID_cool->idleRange); |
2112 srv_send((char *)"PIDC_PGAIN,%.3f", unit->PID_cool->pGain); |
2126 srv_send((char *)"PIDC_PGAIN,%.3f", unit->PID_cool->pGain); |
2113 srv_send((char *)"PIDC_IGAIN,%.3f", unit->PID_cool->iGain); |
2127 srv_send((char *)"PIDC_IGAIN,%.3f", unit->PID_cool->iGain); |
2116 } |
2130 } |
2117 srv_send((char *)"FAN_ADDRESS,%s", unit->fan_address); |
2131 srv_send((char *)"FAN_ADDRESS,%s", unit->fan_address); |
2118 srv_send((char *)"FAN_STATE,%d", unit->fan_state); |
2132 srv_send((char *)"FAN_STATE,%d", unit->fan_state); |
2119 srv_send((char *)"FAN_DELAY,%d", unit->fan_delay); |
2133 srv_send((char *)"FAN_DELAY,%d", unit->fan_delay); |
2120 srv_send((char *)"FAN_USAGE,%d", unit->fan_usage); |
2134 srv_send((char *)"FAN_USAGE,%d", unit->fan_usage); |
|
2135 srv_send((char *)"FAN_IDX,%d", unit->fan_idx); |
2121 srv_send((char *)"LIGHT_ADDRESS,%s", unit->light_address); |
2136 srv_send((char *)"LIGHT_ADDRESS,%s", unit->light_address); |
2122 srv_send((char *)"LIGHT_STATE,%d", unit->light_state); |
2137 srv_send((char *)"LIGHT_STATE,%d", unit->light_state); |
2123 srv_send((char *)"LIGHT_DELAY,%d", unit->light_delay); |
2138 srv_send((char *)"LIGHT_DELAY,%d", unit->light_delay); |
2124 srv_send((char *)"LIGHT_USAGE,%d", unit->light_usage); |
2139 srv_send((char *)"LIGHT_USAGE,%d", unit->light_usage); |
|
2140 srv_send((char *)"LIGHT_IDX,%d", unit->light_idx); |
2125 srv_send((char *)"DOOR_ADDRESS,%s", unit->door_address); |
2141 srv_send((char *)"DOOR_ADDRESS,%s", unit->door_address); |
2126 srv_send((char *)"DOOR_STATE,%d", unit->door_state); |
2142 srv_send((char *)"DOOR_STATE,%d", unit->door_state); |
|
2143 srv_send((char *)"DOOR_IDX,%d", unit->door_idx); |
2127 srv_send((char *)"PSU_ADDRESS,%s", unit->psu_address); |
2144 srv_send((char *)"PSU_ADDRESS,%s", unit->psu_address); |
2128 srv_send((char *)"PSU_STATE,%d", unit->psu_state); |
2145 srv_send((char *)"PSU_STATE,%d", unit->psu_state); |
|
2146 srv_send((char *)"PSU_IDX,%d", unit->psu_idx); |
2129 srv_send((char *)"MODE,%s", UNITMODE[unit->mode]); |
2147 srv_send((char *)"MODE,%s", UNITMODE[unit->mode]); |
2130 srv_send((char *)"FRIDGE_SET,%.1f", unit->fridge_set); |
2148 srv_send((char *)"FRIDGE_SET,%.1f", unit->fridge_set); |
2131 srv_send((char *)"BEER_SET,%.1f", unit->beer_set); |
2149 srv_send((char *)"BEER_SET,%.1f", unit->beer_set); |
2132 srv_send((char *)"PROFILE,%s", unit->profile); |
2150 srv_send((char *)"PROFILE,%s", unit->profile); |
2133 srv_send((char *)"PROF_STARTED,%d", (int)unit->prof_started); |
2151 srv_send((char *)"PROF_STARTED,%d", (int)unit->prof_started); |
2216 device_count(TRUE, unit->air_address); |
2234 device_count(TRUE, unit->air_address); |
2217 } else |
2235 } else |
2218 unit->air_address = NULL; |
2236 unit->air_address = NULL; |
2219 unit->mqtt_flag |= MQTT_FLAG_DATA; |
2237 unit->mqtt_flag |= MQTT_FLAG_DATA; |
2220 |
2238 |
|
2239 } else if (val && (strcmp(kwd, (char *)"AIR_IDX") == 0)) { |
|
2240 if (sscanf(val, "%d", &ival) == 1) { |
|
2241 if (unit->air_idx != ival) |
|
2242 syslog(LOG_NOTICE, "Fermenter unit %s air idx %d to %d", unit->uuid, unit->air_idx, ival); |
|
2243 unit->air_idx = ival; |
|
2244 } |
|
2245 |
2221 } else if (strcmp(kwd, (char *)"BEER_ADDRESS") == 0) { |
2246 } else if (strcmp(kwd, (char *)"BEER_ADDRESS") == 0) { |
2222 if (val && unit->beer_address && (strcmp(val, unit->beer_address))) |
2247 if (val && unit->beer_address && (strcmp(val, unit->beer_address))) |
2223 syslog(LOG_NOTICE, "Fermenter unit %s beer address `%s' to `%s'", unit->uuid, unit->beer_address, val); |
2248 syslog(LOG_NOTICE, "Fermenter unit %s beer address `%s' to `%s'", unit->uuid, unit->beer_address, val); |
2224 if (unit->beer_address) { |
2249 if (unit->beer_address) { |
2225 device_count(FALSE, unit->beer_address); |
2250 device_count(FALSE, unit->beer_address); |
2230 device_count(TRUE, unit->beer_address); |
2255 device_count(TRUE, unit->beer_address); |
2231 } else |
2256 } else |
2232 unit->beer_address = NULL; |
2257 unit->beer_address = NULL; |
2233 unit->mqtt_flag |= MQTT_FLAG_DATA; |
2258 unit->mqtt_flag |= MQTT_FLAG_DATA; |
2234 |
2259 |
|
2260 } else if (val && (strcmp(kwd, (char *)"BEER_IDX") == 0)) { |
|
2261 if (sscanf(val, "%d", &ival) == 1) { |
|
2262 if (unit->beer_idx != ival) |
|
2263 syslog(LOG_NOTICE, "Fermenter unit %s beer idx %d to %d", unit->uuid, unit->beer_idx, ival); |
|
2264 unit->beer_idx = ival; |
|
2265 } |
|
2266 |
2235 } else if (strcmp(kwd, (char *)"HEATER_ADDRESS") == 0) { |
2267 } else if (strcmp(kwd, (char *)"HEATER_ADDRESS") == 0) { |
2236 if (val && unit->heater_address && (strcmp(val, unit->heater_address))) |
2268 if (val && unit->heater_address && (strcmp(val, unit->heater_address))) |
2237 syslog(LOG_NOTICE, "Fermenter unit %s heater address `%s' to `%s'", unit->uuid, unit->heater_address, val); |
2269 syslog(LOG_NOTICE, "Fermenter unit %s heater address `%s' to `%s'", unit->uuid, unit->heater_address, val); |
2238 if (unit->heater_address) { |
2270 if (unit->heater_address) { |
2239 device_count(FALSE, unit->heater_address); |
2271 device_count(FALSE, unit->heater_address); |
2252 syslog(LOG_NOTICE, "Fermenter unit %s heater state %d to %d", unit->uuid, unit->heater_state, ival); |
2284 syslog(LOG_NOTICE, "Fermenter unit %s heater state %d to %d", unit->uuid, unit->heater_state, ival); |
2253 unit->heater_state = ival; |
2285 unit->heater_state = ival; |
2254 unit->mqtt_flag |= MQTT_FLAG_DATA; |
2286 unit->mqtt_flag |= MQTT_FLAG_DATA; |
2255 } |
2287 } |
2256 |
2288 |
|
2289 } else if (val && (strcmp(kwd, (char *)"HEATER_IDX") == 0)) { |
|
2290 if (sscanf(val, "%d", &ival) == 1) { |
|
2291 if (unit->heater_idx != ival) |
|
2292 syslog(LOG_NOTICE, "Fermenter unit %s heater idx %d to %d", unit->uuid, unit->heater_idx, ival); |
|
2293 unit->heater_idx = ival; |
|
2294 } |
|
2295 |
2257 } else if (val && (strcmp(kwd, (char *)"HEATER_DELAY") == 0)) { |
2296 } else if (val && (strcmp(kwd, (char *)"HEATER_DELAY") == 0)) { |
2258 if (sscanf(val, "%d", &ival) == 1) { |
2297 if (sscanf(val, "%d", &ival) == 1) { |
2259 if (unit->heater_delay != ival) |
2298 if (unit->heater_delay != ival) |
2260 syslog(LOG_NOTICE, "Fermenter unit %s heater delay %d to %d", unit->uuid, unit->heater_delay, ival); |
2299 syslog(LOG_NOTICE, "Fermenter unit %s heater delay %d to %d", unit->uuid, unit->heater_delay, ival); |
2261 unit->heater_delay = ival; |
2300 unit->heater_delay = ival; |
2286 } else if (val && (strcmp(kwd, (char *)"COOLER_DELAY") == 0)) { |
2325 } else if (val && (strcmp(kwd, (char *)"COOLER_DELAY") == 0)) { |
2287 if (sscanf(val, "%d", &ival) == 1) { |
2326 if (sscanf(val, "%d", &ival) == 1) { |
2288 if (unit->cooler_delay != ival) |
2327 if (unit->cooler_delay != ival) |
2289 syslog(LOG_NOTICE, "Fermenter unit %s cooler delay %d to %d", unit->uuid, unit->cooler_delay, ival); |
2328 syslog(LOG_NOTICE, "Fermenter unit %s cooler delay %d to %d", unit->uuid, unit->cooler_delay, ival); |
2290 unit->cooler_delay = ival; |
2329 unit->cooler_delay = ival; |
|
2330 } |
|
2331 |
|
2332 } else if (val && (strcmp(kwd, (char *)"COOLER_IDX") == 0)) { |
|
2333 if (sscanf(val, "%d", &ival) == 1) { |
|
2334 if (unit->cooler_idx != ival) |
|
2335 syslog(LOG_NOTICE, "Fermenter unit %s cooler idx %d to %d", unit->uuid, unit->cooler_idx, ival); |
|
2336 unit->cooler_idx = ival; |
2291 } |
2337 } |
2292 |
2338 |
2293 } else if (strcmp(kwd, (char *)"FAN_ADDRESS") == 0) { |
2339 } else if (strcmp(kwd, (char *)"FAN_ADDRESS") == 0) { |
2294 if (val && unit->fan_address && (strcmp(val, unit->fan_address))) |
2340 if (val && unit->fan_address && (strcmp(val, unit->fan_address))) |
2295 syslog(LOG_NOTICE, "Fermenter unit %s fan address `%s' to `%s'", unit->uuid, unit->fan_address, val); |
2341 syslog(LOG_NOTICE, "Fermenter unit %s fan address `%s' to `%s'", unit->uuid, unit->fan_address, val); |
2317 if (unit->fan_delay != ival) |
2363 if (unit->fan_delay != ival) |
2318 syslog(LOG_NOTICE, "Fermenter unit %s fan delay %d to %d", unit->uuid, unit->fan_delay, ival); |
2364 syslog(LOG_NOTICE, "Fermenter unit %s fan delay %d to %d", unit->uuid, unit->fan_delay, ival); |
2319 unit->fan_delay = ival; |
2365 unit->fan_delay = ival; |
2320 } |
2366 } |
2321 |
2367 |
|
2368 } else if (val && (strcmp(kwd, (char *)"FAN_IDX") == 0)) { |
|
2369 if (sscanf(val, "%d", &ival) == 1) { |
|
2370 if (unit->fan_idx != ival) |
|
2371 syslog(LOG_NOTICE, "Fermenter unit %s fan idx %d to %d", unit->uuid, unit->fan_idx, ival); |
|
2372 unit->fan_idx = ival; |
|
2373 } |
|
2374 |
2322 } else if (strcmp(kwd, (char *)"LIGHT_ADDRESS") == 0) { |
2375 } else if (strcmp(kwd, (char *)"LIGHT_ADDRESS") == 0) { |
2323 if (val && unit->light_address && (strcmp(val, unit->light_address))) |
2376 if (val && unit->light_address && (strcmp(val, unit->light_address))) |
2324 syslog(LOG_NOTICE, "Fermenter unit %s light address `%s' to `%s'", unit->uuid, unit->light_address, val); |
2377 syslog(LOG_NOTICE, "Fermenter unit %s light address `%s' to `%s'", unit->uuid, unit->light_address, val); |
2325 if (unit->light_address) { |
2378 if (unit->light_address) { |
2326 device_count(FALSE, unit->light_address); |
2379 device_count(FALSE, unit->light_address); |
2346 if (unit->light_delay != ival) |
2399 if (unit->light_delay != ival) |
2347 syslog(LOG_NOTICE, "Fermenter unit %s light delay %d to %d", unit->uuid, unit->light_delay, ival); |
2400 syslog(LOG_NOTICE, "Fermenter unit %s light delay %d to %d", unit->uuid, unit->light_delay, ival); |
2348 unit->light_delay = ival; |
2401 unit->light_delay = ival; |
2349 } |
2402 } |
2350 |
2403 |
|
2404 } else if (val && (strcmp(kwd, (char *)"LIGHT_IDX") == 0)) { |
|
2405 if (sscanf(val, "%d", &ival) == 1) { |
|
2406 if (unit->light_idx != ival) |
|
2407 syslog(LOG_NOTICE, "Fermenter unit %s light idx %d to %d", unit->uuid, unit->light_idx, ival); |
|
2408 unit->light_idx = ival; |
|
2409 } |
|
2410 |
2351 } else if (strcmp(kwd, (char *)"DOOR_ADDRESS") == 0) { |
2411 } else if (strcmp(kwd, (char *)"DOOR_ADDRESS") == 0) { |
2352 if (val && unit->door_address && (strcmp(val, unit->door_address))) |
2412 if (val && unit->door_address && (strcmp(val, unit->door_address))) |
2353 syslog(LOG_NOTICE, "Fermenter unit %s door address `%s' to `%s'", unit->uuid, unit->door_address, val); |
2413 syslog(LOG_NOTICE, "Fermenter unit %s door address `%s' to `%s'", unit->uuid, unit->door_address, val); |
2354 if (unit->door_address) { |
2414 if (unit->door_address) { |
2355 device_count(FALSE, unit->door_address); |
2415 device_count(FALSE, unit->door_address); |
2359 unit->door_address = xstrcpy(val); |
2419 unit->door_address = xstrcpy(val); |
2360 device_count(TRUE, unit->door_address); |
2420 device_count(TRUE, unit->door_address); |
2361 } else |
2421 } else |
2362 unit->door_address = NULL; |
2422 unit->door_address = NULL; |
2363 |
2423 |
|
2424 } else if (val && (strcmp(kwd, (char *)"DOOR_IDX") == 0)) { |
|
2425 if (sscanf(val, "%d", &ival) == 1) { |
|
2426 if (unit->door_idx != ival) |
|
2427 syslog(LOG_NOTICE, "Fermenter unit %s door idx %d to %d", unit->uuid, unit->door_idx, ival); |
|
2428 unit->door_idx = ival; |
|
2429 } |
|
2430 |
2364 } else if (strcmp(kwd, (char *)"PSU_ADDRESS") == 0) { |
2431 } else if (strcmp(kwd, (char *)"PSU_ADDRESS") == 0) { |
2365 if (val && unit->psu_address && (strcmp(val, unit->psu_address))) |
2432 if (val && unit->psu_address && (strcmp(val, unit->psu_address))) |
2366 syslog(LOG_NOTICE, "Fermenter unit %s psu address `%s' to `%s'", unit->uuid, unit->psu_address, val); |
2433 syslog(LOG_NOTICE, "Fermenter unit %s psu address `%s' to `%s'", unit->uuid, unit->psu_address, val); |
2367 if (unit->psu_address) { |
2434 if (unit->psu_address) { |
2368 device_count(FALSE, unit->psu_address); |
2435 device_count(FALSE, unit->psu_address); |
2372 unit->psu_address = xstrcpy(val); |
2439 unit->psu_address = xstrcpy(val); |
2373 device_count(TRUE, unit->psu_address); |
2440 device_count(TRUE, unit->psu_address); |
2374 } else |
2441 } else |
2375 unit->psu_address = NULL; |
2442 unit->psu_address = NULL; |
2376 unit->mqtt_flag |= MQTT_FLAG_DATA; |
2443 unit->mqtt_flag |= MQTT_FLAG_DATA; |
|
2444 |
|
2445 } else if (val && (strcmp(kwd, (char *)"PSU_IDX") == 0)) { |
|
2446 if (sscanf(val, "%d", &ival) == 1) { |
|
2447 if (unit->psu_idx != ival) |
|
2448 syslog(LOG_NOTICE, "Fermenter unit %s psu idx %d to %d", unit->uuid, unit->psu_idx, ival); |
|
2449 unit->psu_idx = ival; |
|
2450 } |
2377 |
2451 |
2378 } else if (val && (strcmp(kwd, (char *)"MODE") == 0)) { |
2452 } else if (val && (strcmp(kwd, (char *)"MODE") == 0)) { |
2379 for (i = 0; i < 5; i++) { |
2453 for (i = 0; i < 5; i++) { |
2380 if (strcmp(val, UNITMODE[i]) == 0) { |
2454 if (strcmp(val, UNITMODE[i]) == 0) { |
2381 /* Initialize log if the unit is turned on */ |
2455 /* Initialize log if the unit is turned on */ |