import 'package:cron/cron.dart';
import "package:springcontrol/ladedaten.dart";
import "package:daciapackete/auswertungen.dart";
import 'package:daciapackete/globals.dart' as globals;

Future<void> cronJobs() async {
  final cronLaden = Cron();
  final cronKlima = Cron();

  //try {
    cronLaden.schedule(Schedule.parse('*/5 * * * *'), () async {
      print("Cron Daten**********************");
     if (globals.configProxyServer == true) {
       await ladeConfig();
     }
       await ladeAutodaten();
       await Auswertungen().auswertungLademanagement();
   //    callSetState();
     });

  cronKlima.schedule(Schedule.parse('*/1 * * * *'), () async {
    if (globals.configProxyServer == true) {
      await ladeConfig();
    }
    print("Cron Klima**********************");
   await Auswertungen().auswertungKlimamanagement();
    //print (globals.config.klimaSofortStarten);
  });


}
