mirror of
https://github.com/beestat/app.git
synced 2025-06-05 14:48:34 -04:00
Fixed sensor runtime doing way too many queries
This commit is contained in:
parent
a05b2aac60
commit
a7b4c1a55e
@ -580,6 +580,7 @@ class runtime extends cora\api {
|
||||
$row,
|
||||
$ecobee_columns
|
||||
);
|
||||
|
||||
$datas = [];
|
||||
|
||||
foreach ($columns as $key => $value) {
|
||||
@ -623,10 +624,15 @@ class runtime extends cora\api {
|
||||
$capability['id'] == $capability_identifier &&
|
||||
in_array($capability['type'], ['temperature', 'occupancy']) === true
|
||||
) {
|
||||
if ($value === null) {
|
||||
$datas[$sensor['sensor_id']][$capability['type']] = null;
|
||||
} else {
|
||||
$datas[$sensor['sensor_id']][$capability['type']] = ($capability['type'] === 'temperature') ? ($value * 10) : $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create or update the database
|
||||
foreach ($datas as $data) {
|
||||
@ -641,7 +647,6 @@ class runtime extends cora\api {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ecobee "interval" value from a timestamp.
|
||||
|
Loading…
x
Reference in New Issue
Block a user