@if ($rooms->isEmpty())

{{ __('rooms.empty') }}

@else
@foreach ($rooms as $room) @php $devices = $room->devices; $entities = $devices->flatMap->entities; $online = $devices->filter->isOnline()->count(); $lightsOn = $entities->filter(fn ($e) => in_array($e->type, ['light', 'switch']) && data_get($e->state, 'state.on') === true)->count(); $open = $entities->filter(fn ($e) => $e->type === 'contact' && data_get($e->state, 'state.open') === true)->count(); @endphp
{{ $room->name }}
{{ $online }}/{{ $devices->count() }} {{ __('rooms.online') }} @if ($lightsOn > 0) {{ $lightsOn }} {{ __('rooms.lights') }} @endif @if ($open > 0) {{ $open }} {{ __('rooms.open') }} @endif
@endforeach
@endif