Use configured home location
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user