['timeout' => 2]]); $raw = @file_get_contents($url, false, $ctx); return ($raw !== false) ? json_decode($raw, true) : null; } /* ---------- Helper: format epoch to Pacific time ---------- */ function fmt_ts(int $epoch): string { $dt = new DateTime("@$epoch"); $dt->setTimezone(new DateTimeZone('America/Los_Angeles')); // 1:30:30 pm 10-14-2026 return $dt->format('g:i:s a m-d-Y'); } /* ---------- Load data ---------- */ $api_url = "$api_host:$api_port$api_path"; $payload = fetch_json($api_url); ?>
⚠️ Could not fetch data from the API.
| Device | Comment | Sensor Time | Temp (°C) | Humidity % ?>
|---|---|---|---|
| = htmlspecialchars($s['name']) ?> | = $comment ?> | First seen: = $sensorFirst ?> Last seen: = $sensorLast ?> |
= $tempF.'°F' ?> First seen: = $tFirst ?> Last seen: = $tLast ?> |
= $humStr.'%' ?>