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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user