mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-27 06:32:19 +03:00
@@ -11,22 +11,23 @@ class Weather : public IoTItem
|
||||
private:
|
||||
String _location;
|
||||
String _param;
|
||||
long interval;
|
||||
// long interval;
|
||||
|
||||
public:
|
||||
Weather(String parameters) : IoTItem(parameters)
|
||||
{
|
||||
_location = jsonReadStr(parameters, "location");
|
||||
_param = jsonReadStr(parameters, "param");
|
||||
jsonRead(parameters, F("int"), interval);
|
||||
interval = interval * 1000 * 60 * 60; // интервал проверки погоды в часах
|
||||
long interval;
|
||||
jsonRead(parameters, F("int"), interval); // интервал проверки погоды в часах
|
||||
setInterval(interval * 60 * 60);
|
||||
}
|
||||
|
||||
void getWeather()
|
||||
{
|
||||
String ret;
|
||||
|
||||
if (WiFi.status() == WL_CONNECTED)
|
||||
if (isNetworkActive())
|
||||
{
|
||||
// char c;
|
||||
String payload;
|
||||
@@ -113,19 +114,21 @@ public:
|
||||
regEvent(value.valS, "Weather");
|
||||
}
|
||||
}
|
||||
void loop()
|
||||
{
|
||||
if (enableDoByInt)
|
||||
{
|
||||
currentMillis = millis();
|
||||
difference = currentMillis - prevMillis;
|
||||
if (difference >= interval)
|
||||
{
|
||||
prevMillis = millis();
|
||||
this->doByInterval();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// void loop()
|
||||
// {
|
||||
// if (enableDoByInt)
|
||||
// {
|
||||
// currentMillis = millis();
|
||||
// difference = currentMillis - prevMillis;
|
||||
// if (difference >= interval)
|
||||
// {
|
||||
// prevMillis = millis();
|
||||
// this->doByInterval();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
IoTValue execute(String command, std::vector<IoTValue> ¶m)
|
||||
{
|
||||
if (command == "get")
|
||||
|
||||
Reference in New Issue
Block a user