package com.example.MeteoStarSpring.dop.smart;

import com.example.MeteoStarSpring.dop.Esp32Client;

public class Smart {


     void proverka(double norms_temp_double, String esp_temp, String smart_time, String ip, String token,
                   String num_rele) {
          Esp32Client esp = new Esp32Client();
          // esp.Esp32GetJson(ip, token);
          if (Double.parseDouble(esp_temp) < norms_temp_double) {
               int dop = Integer.parseInt(smart_time) * 1000;

               // отправляем http запрос
               System.out.println("Включаем реле - "+num_rele+" на "+dop+" секунд!");
               esp.startReleOnOff(ip, token, num_rele, "2");
               try {
                    Thread.sleep(dop);
               } catch (InterruptedException e) {
                    e.printStackTrace();
               }
               esp.startReleOnOff(ip, token, num_rele, "1");
               System.out.println("Вылючаем реле - "+num_rele);
          }
     }
}
