From e9f7bdbdfb34800f4c708e1d8f1a04c78fe56afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc?= <1536036+zoic21@users.noreply.github.com> Date: Tue, 29 Oct 2024 16:14:37 +0100 Subject: [PATCH] same --- core/class/weather.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/class/weather.class.php b/core/class/weather.class.php index effe5a1..01e24ec 100644 --- a/core/class/weather.class.php +++ b/core/class/weather.class.php @@ -1035,10 +1035,15 @@ public function updateWeatherData() { $request_http = new com_http($url); $request_http->setHeader(array('Autorization: ' . sha512(mb_strtolower(config::byKey('market::username')) . ':' . config::byKey('market::password')))); $datas = json_decode($request_http->exec(60,6), true); - log::add(__CLASS__, 'debug', $url . ' : ' . json_encode($datas)); + if ($datas['state'] != 'ok') { + sleep(15); + $datas = json_decode($request_http->exec(60,6), true); + } if ($datas['state'] != 'ok') { return; } + + log::add(__CLASS__, 'debug', $url . ' : ' . json_encode($datas)); $changed = false; $changed = $this->checkAndUpdateCmd('temperature', $datas['data']['today']['temperature']['value']) || $changed; $changed = $this->checkAndUpdateCmd('humidity', $datas['data']['today']['humidity']['value']) || $changed;