Use configured home location

This commit is contained in:
seo
2026-06-18 17:19:29 +09:00
parent 25fe661cc1
commit 325d521044
3 changed files with 46 additions and 11 deletions
+8
View File
@@ -106,6 +106,12 @@ if (isset($_GET['action']) && $_GET['action'] === 'webhook') {
$config = custom_config();
$entities = $config['entities'];
$findmydeviceHaProfiles = ['seoul', 'main'];
$findmydeviceHomeConfig = is_array($config['findmydevice_home'] ?? null) ? $config['findmydevice_home'] : [];
$findmydeviceHome = [
'latitude' => isset($findmydeviceHomeConfig['latitude']) ? (float)$findmydeviceHomeConfig['latitude'] : null,
'longitude' => isset($findmydeviceHomeConfig['longitude']) ? (float)$findmydeviceHomeConfig['longitude'] : null,
'radius_m' => max(1, (int)($findmydeviceHomeConfig['radius_m'] ?? 50)),
];
function isMeaningfulHaValue($state): bool
{
@@ -771,6 +777,7 @@ if (isset($_GET['hashonly']) && $_GET['hashonly'] == '1') {
'aaccuracy' => $aaccuracyMap[$lang][$aaccuracyState] ?? $aaccuracyState ?? null,
'connection' => $connectionMap[$lang][$connectionState] ?? $connectionState ?? null,
'sensors' => $sensorSections,
'home' => $findmydeviceHome,
]);
echo json_encode(['hash' => hash('sha256', $raw)]);
@@ -794,6 +801,7 @@ echo json_encode([
'aaccuracy' => $aaccuracyMap[$lang][$aaccuracyState] ?? $aaccuracyState ?? null,
'connection' => $connectionMap[$lang][$connectionState] ?? $connectionState ?? null,
'sensors' => $sensorSections,
'home' => $findmydeviceHome,
'history' => $includeHistory ? $path : null,
'historyRawCount' => $includeHistory ? $historyRawCount : null,
'historyRenderCount' => $includeHistory ? count($path) : null,