From 0b5f1e13b85f2f884e1fdb1bd1869845af4872b5 Mon Sep 17 00:00:00 2001 From: Jon Ziebell Date: Tue, 27 Aug 2024 22:23:45 -0400 Subject: [PATCH] Fixed a new daylight savings sync issue --- api/ecobee.php | 11 +++++++++++ api/runtime.php | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/api/ecobee.php b/api/ecobee.php index 127cf69..8f5b937 100644 --- a/api/ecobee.php +++ b/api/ecobee.php @@ -282,6 +282,17 @@ class ecobee extends external_api { $this->log_mysql($curl_response, true); } throw new cora\exception('No thermostats found.', 10511, false, null, false); + } else if ( + isset($response['status']['message']) === true && + stripos($response['status']['message'], 'Processing error.') !== false + ) { + // Processing error. Generic error...this started happening in August + // 2024 when attempting to sync any date range that included + // the "missing hour" from daylight savings. + if($this::$log_mysql !== 'all') { + $this->log_mysql($curl_response, true); + } + throw new cora\exception('Generic processing error.', 10512, false, null, false); } } else if (isset($response['status']) === true && $response['status']['code'] !== 0) { diff --git a/api/runtime.php b/api/runtime.php index e977d94..2ae4de5 100644 --- a/api/runtime.php +++ b/api/runtime.php @@ -405,6 +405,12 @@ class runtime extends cora\api { strtotime('-1 hour', $begin), strtotime('+1 hour', $end) ); + } else if($e->getCode() === 10512) { + // Processing error. Just pretend it worked and move on. + return [ + 'data_begin' => $begin, + 'data_end' => $end + ]; } else { throw new cora\exception($e->getMessage(), $e->getCode(), $e->getReportable(), $e->getExtraInfo(), $e->getRollback()); }