Error handling
This commit is contained in:
@@ -1007,7 +1007,7 @@ class TelemetryController extends Controller
|
||||
|
||||
return [
|
||||
'assetName' => $asset->name,
|
||||
'assetHealth' => $this->getAssetHealth($deviceHealthStatuses),
|
||||
'assetHealth' => $deviceHealthStatuses ? $this->getAssetHealth($deviceHealthStatuses) : null,
|
||||
'devices' => $devicesData
|
||||
];
|
||||
|
||||
@@ -1126,19 +1126,33 @@ class TelemetryController extends Controller
|
||||
foreach ($data as $key => $items) {
|
||||
|
||||
foreach ($items as $item) {
|
||||
|
||||
$ts['startTs'] = Carbon::now()->subHours(6)->timestamp * 1000;
|
||||
$ts['endTs'] = Carbon::now()->timestamp * 1000;
|
||||
$pastValues = $this->customerInfoService->fetchTelemetryData($device->id, $key, $ts);
|
||||
$pastValTotal = 1;
|
||||
// $itemTotal
|
||||
foreach($pastValues as $past){
|
||||
// $pastValTotal
|
||||
}
|
||||
|
||||
// echo "$i -".count($pastValues)."\n";
|
||||
$transformedTelemetry[] = [
|
||||
'display_name' => $displayNameMap[$key] ?? $key,
|
||||
'value' => $item['value']
|
||||
'value' => $item['value'],
|
||||
'pastValue' => $pastValues ? $pastValues[$key] : []
|
||||
];
|
||||
}
|
||||
// exit;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'deviceId' => $device->id,
|
||||
'deviceName' => $device->name,
|
||||
'deviceType' => $deviceProfileName,
|
||||
'indicator' => $transformedTelemetry
|
||||
'deviceId' => $device->id,
|
||||
'deviceName' => $device->name,
|
||||
'deviceType' => $deviceProfileName,
|
||||
'deviceSensor' => $device->sensor,
|
||||
'indicator' => $transformedTelemetry
|
||||
];
|
||||
})->values();
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('devices', function (Blueprint $table) {
|
||||
$table->string('sensor')->after('type')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('devices', function (Blueprint $table) {
|
||||
$table->dropColumn('sensor');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user