@extends('layouts.app') @push('styles') @endpush @push('styles') @endpush @section('title', 'Sensor Details - ' . $sensor->device_uuid) @section('content')

Debug Information

Sensor ID: {{ $sensor->id }}

Last Latitude: {{ $sensor->last_latitude ?? 'null' }}

Last Longitude: {{ $sensor->last_longitude ?? 'null' }}

Has Valid Location: {{ $hasValidLocation ? 'Yes' : 'No' }}

Last Ping: {{ $sensor->last_ping ? $sensor->last_ping->diffForHumans() : 'Never' }}

Sensor: {{ $sensor->device_uuid }}

Last updated: {{ $sensor->last_ping ? $sensor->last_ping->diffForHumans() : 'Never' }}

{{ ucfirst($sensor->status) }} {{ $sensor->is_active ? 'Active' : 'Inactive' }}

Gas Level

{{ $sensor->last_gas_level ?? 0 }}%

Battery Level

{{ $sensor->battery_level ?? 0 }}%

Last Ping

{{ $sensor->last_ping ? $sensor->last_ping->diffForHumans() : 'Never' }}

Active Alerts

{{ $sensor->alerts()->where('is_resolved', false)->count() }}

@php // Consider coordinates invalid if they're exactly 0,0 (Null Island) or null $latitude = $sensor->latitude ?? $sensor->last_latitude ?? null; $longitude = $sensor->longitude ?? $sensor->last_longitude ?? null; $hasValidLocation = !is_null($latitude) && !is_null($longitude) && ($latitude != 0 || $longitude != 0); @endphp

Sensor Location

@if($hasValidLocation) @else

Location data not available for this sensor

@endif
Coordinates: {{ $latitude }}, {{ $longitude }}

Gas Level Trend

Loading gas level data...

Battery Level Trend

Loading battery level data...

Recent Activity

@forelse($sensor->logs()->latest()->take(10)->get() as $log)

Gas Level: {{ $log->gas_level }}% ({{ $log->created_at->diffForHumans() }})

Battery: {{ $log->battery_level }}% @if($log->is_leak_detected) Gas Leak Detected @endif

{{ $log->created_at->format('M j, Y H:i:s') }}
@empty
No activity recorded yet.
@endforelse
@endsection