1
0
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:
Jon Ziebell
2020-01-16 18:53:34 -05:00
parent a7b4c1a55e
commit 5c64575910
3 changed files with 53 additions and 4 deletions
+26
View File
@@ -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.
*/