고정밀 위치 추적 제어 조건 정리

This commit is contained in:
seo
2026-07-16 19:34:59 +09:00
parent 958d3d3473
commit 4307bb7f92
2 changed files with 32 additions and 10 deletions
+31 -9
View File
@@ -229,6 +229,34 @@ function findmydevice_is_charging(): bool
return strtolower((string)($state['state'] ?? '')) === 'on';
}
function findmydevice_high_accuracy_mode_active(): bool
{
$config = custom_config();
$entity = (string)($config['entities']['high_accuracy_mode'] ?? 'binary_sensor.seocaegeonyi_z_fold7_high_accuracy_mode');
if ($entity === '') {
return false;
}
$state = findmydevice_latest_state($entity);
return strtolower((string)($state['state'] ?? '')) === 'on';
}
function findmydevice_high_accuracy_off_result(): array
{
if (findmydevice_high_accuracy_mode_active()) {
return [
'skipped' => true,
'reason' => 'high_accuracy_mode_active',
];
}
return [
'sent' => findmydevice_mobile_command('command_high_accuracy_mode', [
'command' => 'force_off',
]),
];
}
function findmydevice_auto_tracking_policy(): array
{
$position = findmydevice_current_position();
@@ -270,9 +298,7 @@ function findmydevice_location_refresh(string $name): array
$results['charging'] = $policy['charging'];
$results['requiredBluetoothConnected'] = $policy['required_bluetooth_connected'];
$results['allowWebhook'] = false;
$results['high_accuracy_off'] = findmydevice_mobile_command('command_high_accuracy_mode', [
'command' => 'force_off',
]);
$results['high_accuracy_off'] = findmydevice_high_accuracy_off_result();
return $results;
}
@@ -298,9 +324,7 @@ function findmydevice_location_refresh(string $name): array
$results['charging'] = $policy['charging'];
$results['requiredBluetoothConnected'] = $policy['required_bluetooth_connected'];
$results['allowWebhook'] = false;
$results['high_accuracy_off'] = findmydevice_mobile_command('command_high_accuracy_mode', [
'command' => 'force_off',
]);
$results['high_accuracy_off'] = findmydevice_high_accuracy_off_result();
return $results;
}
@@ -317,9 +341,7 @@ function findmydevice_location_refresh(string $name): array
$results['update_sensors'] = findmydevice_mobile_command('command_update_sensors');
} elseif ($name === 'auto_off') {
$results['allowWebhook'] = false;
$results['high_accuracy_off'] = findmydevice_mobile_command('command_high_accuracy_mode', [
'command' => 'force_off',
]);
$results['high_accuracy_off'] = findmydevice_high_accuracy_off_result();
}
return $results;