@props(['entity'])
@php
$s = $entity->state?->state ?? [];
@endphp
@switch($entity->type)
@case('light')
@case('switch')
@php $on = ($s['on'] ?? false) === true; @endphp
{{ $entity->name }} · {{ $on ? __('devices.on') : __('devices.off') }}
@break
@case('contact')
@php $open = ($s['open'] ?? false) === true; @endphp
{{ $entity->name }} · {{ $open ? __('devices.open') : __('devices.closed') }}
@break
@case('battery')
@php $p = (int) ($s['percent'] ?? 0); $low = $p < 20; @endphp
{{ __('devices.battery') }} · {{ $p }}%
@break
@case('power')
{{ (int) ($s['watts'] ?? 0) }} W
@break
@case('motion')
@php $active = ($s['active'] ?? false) === true; @endphp
{{ $active ? __('devices.motion') : __('devices.no_motion') }}
@break
@endswitch