From 1c3002644cb02c1ef712558b7c990fa5ed9e98a2 Mon Sep 17 00:00:00 2001 From: Jon Ziebell Date: Sat, 20 Nov 2021 06:38:00 -0500 Subject: [PATCH] Added exception handling for "User cannot access thermostat..." error --- api/ecobee.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/ecobee.php b/api/ecobee.php index 6ba3628..1eb7459 100644 --- a/api/ecobee.php +++ b/api/ecobee.php @@ -248,6 +248,16 @@ class ecobee extends external_api { $this->log_mysql($curl_response, true); } throw new cora\exception('Illegal instant due to time zone offset transition.', 10509, false, null, false); + } else if ( + isset($response['status']['message']) === true && + stripos($response['status']['message'], 'User cannot access thermostat with id') !== false + ) { + // Processing error. User cannot access thermostat with id ... + // Not sure why this happens + if($this::$log_mysql !== 'all') { + $this->log_mysql($curl_response, true); + } + throw new cora\exception('User cannot access thermostat.', 10510, false, null, false); } } else if (isset($response['status']) === true && $response['status']['code'] !== 0) {