mirror of
https://github.com/beestat/app.git
synced 2025-06-23 15:30:43 -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,
|
$row,
|
||||||
$ecobee_columns
|
$ecobee_columns
|
||||||
);
|
);
|
||||||
|
|
||||||
$datas = [];
|
$datas = [];
|
||||||
|
|
||||||
foreach ($columns as $key => $value) {
|
foreach ($columns as $key => $value) {
|
||||||
@ -623,10 +624,15 @@ class runtime extends cora\api {
|
|||||||
$capability['id'] == $capability_identifier &&
|
$capability['id'] == $capability_identifier &&
|
||||||
in_array($capability['type'], ['temperature', 'occupancy']) === true
|
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;
|
$datas[$sensor['sensor_id']][$capability['type']] = ($capability['type'] === 'temperature') ? ($value * 10) : $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create or update the database
|
// Create or update the database
|
||||||
foreach ($datas as $data) {
|
foreach ($datas as $data) {
|
||||||
@ -641,7 +647,6 @@ class runtime extends cora\api {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the ecobee "interval" value from a timestamp.
|
* Get the ecobee "interval" value from a timestamp.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user