mirror of
https://github.com/beestat/app.git
synced 2025-05-24 02:14:03 -04:00
Improved error handling for when no thermostats are found.
This commit is contained in:
parent
8c82cc7e54
commit
efbf04d3d4
@ -198,25 +198,29 @@ class ecobee_sensor extends cora\crud {
|
||||
}
|
||||
}
|
||||
|
||||
$response = $this->api(
|
||||
'ecobee',
|
||||
'ecobee_api',
|
||||
[
|
||||
'method' => 'GET',
|
||||
'endpoint' => 'thermostat',
|
||||
'arguments' => [
|
||||
'body' => json_encode([
|
||||
'selection' => array_merge(
|
||||
[
|
||||
'selectionType' => 'thermostats',
|
||||
'selectionMatch' => implode(',', $serial_numbers),
|
||||
],
|
||||
$include
|
||||
)
|
||||
])
|
||||
if(count($serial_numbers) > 0) {
|
||||
$response = $this->api(
|
||||
'ecobee',
|
||||
'ecobee_api',
|
||||
[
|
||||
'method' => 'GET',
|
||||
'endpoint' => 'thermostat',
|
||||
'arguments' => [
|
||||
'body' => json_encode([
|
||||
'selection' => array_merge(
|
||||
[
|
||||
'selectionType' => 'thermostats',
|
||||
'selectionMatch' => implode(',', $serial_numbers),
|
||||
],
|
||||
$include
|
||||
)
|
||||
])
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
);
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
|
@ -161,25 +161,29 @@ class ecobee_thermostat extends cora\crud {
|
||||
}
|
||||
}
|
||||
|
||||
$response = $this->api(
|
||||
'ecobee',
|
||||
'ecobee_api',
|
||||
[
|
||||
'method' => 'GET',
|
||||
'endpoint' => 'thermostat',
|
||||
'arguments' => [
|
||||
'body' => json_encode([
|
||||
'selection' => array_merge(
|
||||
[
|
||||
'selectionType' => 'thermostats',
|
||||
'selectionMatch' => implode(',', $serial_numbers),
|
||||
],
|
||||
$include
|
||||
)
|
||||
])
|
||||
if(count($serial_numbers) > 0) {
|
||||
$response = $this->api(
|
||||
'ecobee',
|
||||
'ecobee_api',
|
||||
[
|
||||
'method' => 'GET',
|
||||
'endpoint' => 'thermostat',
|
||||
'arguments' => [
|
||||
'body' => json_encode([
|
||||
'selection' => array_merge(
|
||||
[
|
||||
'selectionType' => 'thermostats',
|
||||
'selectionMatch' => implode(',', $serial_numbers),
|
||||
],
|
||||
$include
|
||||
)
|
||||
])
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
);
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
|
@ -171,7 +171,11 @@ class thermostat extends cora\crud {
|
||||
|
||||
return true;
|
||||
} catch(cora\exception $e) {
|
||||
return false;
|
||||
if($e->getCode() === 10511) {
|
||||
throw $e;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user