mirror of
https://github.com/beestat/app.git
synced 2026-05-13 10:52:29 -04:00
No longer returning unsupported sensors from the API
This commit is contained in:
@@ -15,6 +15,32 @@ class ecobee_sensor extends cora\crud {
|
||||
'public' => []
|
||||
];
|
||||
|
||||
/**
|
||||
* Normal read_id, but filter out unsupported sensor types.
|
||||
*
|
||||
* @param array $attributes
|
||||
* @param array $columns
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function read_id($attributes = [], $columns = []) {
|
||||
$ecobee_sensors = parent::read_id($attributes, $columns);
|
||||
|
||||
$return = [];
|
||||
foreach($ecobee_sensors as $ecobee_sensor) {
|
||||
if (
|
||||
in_array(
|
||||
$ecobee_sensor['type'],
|
||||
['ecobee3_remote_sensor', 'thermostat']
|
||||
) === true
|
||||
) {
|
||||
$return[$ecobee_sensor['ecobee_sensor_id']] = $ecobee_sensor;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync sensors.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user