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
@@ -19,6 +19,32 @@ class sensor extends cora\crud {
'sync' => 300 // 5 Minutes
];
/**
* Normal read_id, but filter out unsupported sensor types.
*
* @param array $attributes
* @param array $columns
*
* @return array
*/
public function read_id($attributes = [], $columns = []) {
$sensors = parent::read_id($attributes, $columns);
$return = [];
foreach($sensors as $sensor) {
if (
in_array(
$sensor['type'],
['ecobee3_remote_sensor', 'thermostat']
) === true
) {
$return[$sensor['sensor_id']] = $sensor;
}
}
return $return;
}
/**
* Sync all sensors connected to this account. Once Nest support is
* added this will need to check for all connected accounts and run the