No | Tanggal | Perubahan | Status Keamanan | Status Perangkat |
---|---|---|---|---|
{{ $index + 1 }} | {{ date('d/m/Y H:i', strtotime($report['timestamp'])) }} | @php $changes = []; $prevReport = isset($reports[$index+1]) ? $reports[$index+1] : null; // Security changes - only show if there's an actual change from previous value if(isset($report['security'])) { // Motion detection if(isset($report['security']['motion'])) { $currentMotion = $report['security']['motion']; $prevMotion = ($prevReport && isset($prevReport['security']['motion'])) ? $prevReport['security']['motion'] : null; if($prevMotion !== $currentMotion && $currentMotion != 'none') { $changes[] = [ 'type' => 'Motion: ' . ucfirst($currentMotion), 'badge' => 'badge-motion' ]; } } // Security status if(isset($report['security']['status'])) { $currentStatus = $report['security']['status']; $prevStatus = ($prevReport && isset($prevReport['security']['status'])) ? $prevReport['security']['status'] : null; if($prevStatus !== $currentStatus && !empty($currentStatus)) { $changes[] = [ 'type' => 'Status: ' . ucfirst($currentStatus), 'badge' => 'badge-status' ]; } } // Fan status if(isset($report['security']['fan'])) { $currentFan = $report['security']['fan']; $prevFan = ($prevReport && isset($prevReport['security']['fan'])) ? $prevReport['security']['fan'] : null; if($prevFan !== $currentFan) { $changes[] = [ 'type' => 'Fan: ' . ucfirst($currentFan), 'badge' => 'badge-fan' ]; } } } // SmartCab changes if(isset($report['smartcab'])) { // Servo status if(isset($report['smartcab']['servo_status'])) { $currentServo = $report['smartcab']['servo_status']; $prevServo = ($prevReport && isset($prevReport['smartcab']['servo_status'])) ? $prevReport['smartcab']['servo_status'] : null; if($prevServo !== $currentServo && !empty($currentServo)) { $changes[] = [ 'type' => 'Servo: ' . $currentServo, 'badge' => 'badge-servo-status' ]; } } // Last access if(isset($report['smartcab']['last_access'])) { $currentAccess = $report['smartcab']['last_access']; $prevAccess = ($prevReport && isset($prevReport['smartcab']['last_access'])) ? $prevReport['smartcab']['last_access'] : null; if($prevAccess !== $currentAccess && !empty($currentAccess)) { $changes[] = [ 'type' => 'Access: ' . $currentAccess, 'badge' => 'badge-last-access' ]; } } } // Control changes - these are boolean events, so just show them when true if(isset($report['control'])) { if(isset($report['control']['restartESP']) && $report['control']['restartESP'] === true) { $changes[] = ['type' => 'ESP Restart', 'badge' => 'badge-restart-esp']; } if(isset($report['control']['restartWemos']) && $report['control']['restartWemos'] === true) { $changes[] = ['type' => 'Wemos Restart', 'badge' => 'badge-restart-wemos']; } } // Sensor changes - for the first report, show initial values if($index === 0 || !$prevReport) { if(isset($report['dht11'])) { if(isset($report['dht11']['temperature'])) { $changes[] = [ 'type' => 'Suhu: ' . $report['dht11']['temperature'] . '°C', 'badge' => 'badge-sensor' ]; } if(isset($report['dht11']['humidity'])) { $changes[] = [ 'type' => 'Kelembaban: ' . $report['dht11']['humidity'] . '%', 'badge' => 'badge-sensor' ]; } } } else { // For subsequent reports, only show changes in sensor values if(isset($report['dht11']) && isset($prevReport['dht11'])) { if(isset($report['dht11']['temperature']) && isset($prevReport['dht11']['temperature'])) { $diff = abs($report['dht11']['temperature'] - $prevReport['dht11']['temperature']); if($diff >= 1) { // Only show if temperature changed by at least 1 degree $changes[] = [ 'type' => 'Suhu: ' . $report['dht11']['temperature'] . '°C', 'badge' => 'badge-sensor' ]; } } if(isset($report['dht11']['humidity']) && isset($prevReport['dht11']['humidity'])) { $diff = abs($report['dht11']['humidity'] - $prevReport['dht11']['humidity']); if($diff >= 5) { // Only show if humidity changed by at least 5% $changes[] = [ 'type' => 'Kelembaban: ' . $report['dht11']['humidity'] . '%', 'badge' => 'badge-sensor' ]; } } } } // For first report (most recent), always show current state if($index === 0) { if(empty($changes)) { $changes[] = ['type' => 'Status saat ini', 'badge' => 'badge-info']; } } @endphp @if(count($changes) > 0) @foreach($changes as $change) {{ $change['type'] }} @endforeach @else Tidak ada perubahan @endif |
@if(isset($report['security']))
Gerakan:
@if(isset($report['security']['motion']))
{{ ucfirst($report['security']['motion'] ?? 'Tidak ada') }}
@else
Tidak ada data
@endif
Status:
@if(isset($report['security']['status']))
{{ ucfirst($report['security']['status'] ?? 'Normal') }}
@else
Normal
@endif
Fan:
{{ ucfirst($report['security']['fan'] ?? 'Off') }}
@else
Tidak ada data keamanan
@endif
|
@if(isset($report['smartcab']))
Servo:
{{ $report['smartcab']['servo_status'] ?? 'N/A' }}
@if(isset($report['smartcab']['last_access']) && !empty($report['smartcab']['last_access']))
Akses Terakhir: {{ $report['smartcab']['last_access'] }}
@endif
@endif
@if(isset($report['dht11']))
Sensor DHT11:
Suhu:
{{ $report['dht11']['temperature'] ?? 'N/A' }}°C
Kelembaban: {{ $report['dht11']['humidity'] ?? 'N/A' }}%
@endif
@if(isset($report['control']) && ($report['control']['restartESP'] || $report['control']['restartWemos']))
Restart Status:
@if($report['control']['restartESP'])
ESP restarted
@endif
@if($report['control']['restartWemos'])
Wemos restarted
@endif
@endif
|
Tidak ada data laporan untuk periode yang dipilih |