mirror of
https://github.com/beestat/app.git
synced 2025-06-03 13:46:54 -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(
|
if(count($serial_numbers) > 0) {
|
||||||
'ecobee',
|
$response = $this->api(
|
||||||
'ecobee_api',
|
'ecobee',
|
||||||
[
|
'ecobee_api',
|
||||||
'method' => 'GET',
|
[
|
||||||
'endpoint' => 'thermostat',
|
'method' => 'GET',
|
||||||
'arguments' => [
|
'endpoint' => 'thermostat',
|
||||||
'body' => json_encode([
|
'arguments' => [
|
||||||
'selection' => array_merge(
|
'body' => json_encode([
|
||||||
[
|
'selection' => array_merge(
|
||||||
'selectionType' => 'thermostats',
|
[
|
||||||
'selectionMatch' => implode(',', $serial_numbers),
|
'selectionType' => 'thermostats',
|
||||||
],
|
'selectionMatch' => implode(',', $serial_numbers),
|
||||||
$include
|
],
|
||||||
)
|
$include
|
||||||
])
|
)
|
||||||
|
])
|
||||||
|
]
|
||||||
]
|
]
|
||||||
]
|
);
|
||||||
);
|
} else {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
@ -161,25 +161,29 @@ class ecobee_thermostat extends cora\crud {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = $this->api(
|
if(count($serial_numbers) > 0) {
|
||||||
'ecobee',
|
$response = $this->api(
|
||||||
'ecobee_api',
|
'ecobee',
|
||||||
[
|
'ecobee_api',
|
||||||
'method' => 'GET',
|
[
|
||||||
'endpoint' => 'thermostat',
|
'method' => 'GET',
|
||||||
'arguments' => [
|
'endpoint' => 'thermostat',
|
||||||
'body' => json_encode([
|
'arguments' => [
|
||||||
'selection' => array_merge(
|
'body' => json_encode([
|
||||||
[
|
'selection' => array_merge(
|
||||||
'selectionType' => 'thermostats',
|
[
|
||||||
'selectionMatch' => implode(',', $serial_numbers),
|
'selectionType' => 'thermostats',
|
||||||
],
|
'selectionMatch' => implode(',', $serial_numbers),
|
||||||
$include
|
],
|
||||||
)
|
$include
|
||||||
])
|
)
|
||||||
|
])
|
||||||
|
]
|
||||||
]
|
]
|
||||||
]
|
);
|
||||||
);
|
} else {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,11 @@ class thermostat extends cora\crud {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch(cora\exception $e) {
|
} catch(cora\exception $e) {
|
||||||
return false;
|
if($e->getCode() === 10511) {
|
||||||
|
throw $e;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user