973 |
973 |
974 int server(void) |
974 int server(void) |
975 { |
975 { |
976 char buf[1024], *filename, target_lo[40], target_hi[40], heater[40], cooler[40], fan[40], door[40]; |
976 char buf[1024], *filename, target_lo[40], target_hi[40], heater[40], cooler[40], fan[40], door[40]; |
977 char use_heater[40], use_cooler[40], use_fan[40], room_temp[40]; |
977 char use_heater[40], use_cooler[40], use_fan[40], room_temp[40]; |
978 time_t now, last = (time_t)0; |
978 time_t now, last = (time_t)0, ndata = (time_t)0;; |
979 units_list *unit; |
979 units_list *unit; |
980 profiles_list *profile; |
980 profiles_list *profile; |
981 prof_step *step; |
981 prof_step *step; |
982 int row, rc, run = 1, seconds = 0, minutes = 0, temp, deviation; |
982 int row, rc, run = 1, seconds = 0, minutes = 0, temp, deviation; |
983 int run_seconds, run_minutes, run_hours, tot_minutes, key; |
983 int run_seconds, run_minutes, run_hours, tot_minutes, key; |
1213 } else { |
1213 } else { |
1214 Config.hum_state = 2; |
1214 Config.hum_state = 2; |
1215 } |
1215 } |
1216 } |
1216 } |
1217 row++; |
1217 row++; |
1218 if (updateHT) |
1218 /* |
|
1219 * If TH(B) changed. or if 5 minutes without |
|
1220 * update, send the NDATA message. |
|
1221 */ |
|
1222 if (updateHT || (now > (ndata + 300))) { |
1219 publishNData(false, 0); |
1223 publishNData(false, 0); |
|
1224 ndata = now; |
|
1225 } |
1220 |
1226 |
1221 LCDunit = 0; |
1227 LCDunit = 0; |
1222 for (unit = Config.units; unit; unit = unit->next) { |
1228 for (unit = Config.units; unit; unit = unit->next) { |
1223 LCDunit++; |
1229 LCDunit++; |
1224 unit->mqtt_flag &= ~MQTT_FLAG_DATA; |
1230 unit->mqtt_flag &= ~MQTT_FLAG_DATA; |