1
0
mirror of https://github.com/beestat/app.git synced 2025-06-23 15:30:43 -04:00

Improved error handling for when no thermostats are found.

This commit is contained in:
Jon Ziebell 2023-04-13 22:41:27 -04:00
parent 8c82cc7e54
commit efbf04d3d4
3 changed files with 49 additions and 37 deletions

View File

@ -198,6 +198,7 @@ class ecobee_sensor extends cora\crud {
} }
} }
if(count($serial_numbers) > 0) {
$response = $this->api( $response = $this->api(
'ecobee', 'ecobee',
'ecobee_api', 'ecobee_api',
@ -220,6 +221,9 @@ class ecobee_sensor extends cora\crud {
} else { } else {
throw $e; throw $e;
} }
} else {
throw $e;
}
} }
// Loop over the returned sensors and create/update them as necessary. // Loop over the returned sensors and create/update them as necessary.

View File

@ -161,6 +161,7 @@ class ecobee_thermostat extends cora\crud {
} }
} }
if(count($serial_numbers) > 0) {
$response = $this->api( $response = $this->api(
'ecobee', 'ecobee',
'ecobee_api', 'ecobee_api',
@ -183,6 +184,9 @@ class ecobee_thermostat extends cora\crud {
} else { } else {
throw $e; throw $e;
} }
} else {
throw $e;
}
} }
// Loop over the returned thermostats and create/update them as necessary. // Loop over the returned thermostats and create/update them as necessary.

View File

@ -171,9 +171,13 @@ class thermostat extends cora\crud {
return true; return true;
} catch(cora\exception $e) { } catch(cora\exception $e) {
if($e->getCode() === 10511) {
throw $e;
} else {
return false; return false;
} }
} }
}
/** /**
* Dismiss an alert. * Dismiss an alert.