homeos/app/Livewire/Modals/RingSetup.php

37 lines
1.2 KiB
PHP

<?php
namespace App\Livewire\Modals;
use App\Models\Addon;
use App\Support\HostAddress;
use LivewireUI\Modal\ModalComponent;
/**
* Ring setup guide. Ring has no local API, so the ring-mqtt bridge (a separate container) owns
* the Ring login + 2FA in its OWN web UI — HomeOS never handles Ring credentials. This modal just
* walks the user through starting the bridge and links to it, and reflects the bridge's real MQTT
* status (updated by IngestRingMessage when the bridge publishes online/offline).
*/
class RingSetup extends ModalComponent
{
public static function modalMaxWidth(): string
{
return 'lg';
}
public function render()
{
$addon = Addon::where('key', 'ring')->first();
// The bridge UI runs on the HomeOS host at its configured port.
$host = explode(':', HostAddress::broker())[0];
return view('livewire.modals.ring-setup', [
'status' => $addon?->status ?? 'disconnected',
'statusDetail' => $addon?->status_detail,
'connectedAt' => $addon?->connected_at,
'bridgeUrl' => 'http://'.$host.':'.config('homeos.ring.ui_port', 55123),
]);
}
}