code editor и мелкие правки, добавлена новая прошивка контроллера
This commit is contained in:
1 parent
811d7fb17b
commit
a664ef0bf7
17 files changed
+12266
-343
No files matched your search
@@ -42,4 +42,20 @@ class API {
|
||||
return ['status' => 'ok', 'deviceId' => $deviceId, 'sensor' => $sensor, 'value' => $sensorValue];
|
||||
|
||||
}
|
||||
|
||||
public static function getSensorData()
|
||||
{
|
||||
$sensor = $_REQUEST['sensor'];
|
||||
$deviceId = $_REQUEST['deviceId'];
|
||||
|
||||
$cacheId = md5('CIoT::getPlotDallasValues_' . $deviceId . '_' . $sensor);
|
||||
if (Cache::check($cacheId) and Cache::getAge($cacheId) < 300) {
|
||||
$arValues = Cache::get($cacheId);
|
||||
} else {
|
||||
$arValues = IoT::getPlotDallasValues($deviceId, $sensor);
|
||||
Cache::write($cacheId, $arValues);
|
||||
}
|
||||
|
||||
return ['status' => 'ok', 'deviceId' => $deviceId, 'sensor' => $sensor, 'data' => $arValues];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user