mirror of
https://github.com/beestat/app.git
synced 2025-07-09 03:04:07 -04:00
No longer returning unsupported sensors from the API
This commit is contained in:
parent
a7b4c1a55e
commit
5c64575910
@ -15,6 +15,32 @@ class ecobee_sensor extends cora\crud {
|
|||||||
'public' => []
|
'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.
|
* Sync sensors.
|
||||||
*/
|
*/
|
||||||
|
@ -19,6 +19,32 @@ class sensor extends cora\crud {
|
|||||||
'sync' => 300 // 5 Minutes
|
'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
|
* Sync all sensors connected to this account. Once Nest support is
|
||||||
* added this will need to check for all connected accounts and run the
|
* added this will need to check for all connected accounts and run the
|
||||||
|
@ -20,10 +20,7 @@ beestat.component.card.sensors.prototype.decorate_contents_ = function(parent) {
|
|||||||
if (sensor.thermostat_id === beestat.setting('thermostat_id')) {
|
if (sensor.thermostat_id === beestat.setting('thermostat_id')) {
|
||||||
if (sensor.type === 'thermostat') {
|
if (sensor.type === 'thermostat') {
|
||||||
internal_sensor = sensor;
|
internal_sensor = sensor;
|
||||||
} else if (
|
} else {
|
||||||
sensor.type === 'ecobee3_remote_sensor' ||
|
|
||||||
sensor.type === 'switch_plus'
|
|
||||||
) {
|
|
||||||
sensors.push(sensor);
|
sensors.push(sensor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user