From 97f8eee507989536986e47927b79ff5e8bd6cbb9 Mon Sep 17 00:00:00 2001 From: Clawd Date: Wed, 28 Jan 2026 19:43:00 +0000 Subject: [PATCH] fix: detect all stationary states for arrival notifications TeslaMate uses multiple states for parked cars: online, parked, charging, suspended, asleep, offline. Previously only 'parked' and 'charging' were detected, causing missed arrival notifications when car went directly to 'online' or 'suspended' state. --- arrival-notifier.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arrival-notifier.js b/arrival-notifier.js index 23c9aad..b2e1c7d 100644 --- a/arrival-notifier.js +++ b/arrival-notifier.js @@ -149,9 +149,10 @@ async function handleStateChange(newState) { log.debug(`State: ${state.previousState} → ${newState}`); - // Detect arrival: was driving/moving, now parked or charging - const wasMoving = ['driving', 'online'].includes(state.previousState); - const nowStopped = ['parked', 'charging'].includes(newState); + // Detect arrival: was driving, now stationary + // TeslaMate states: driving, online, parked, charging, suspended, asleep, offline + const wasMoving = state.previousState === 'driving'; + const nowStopped = ['online', 'parked', 'charging', 'suspended', 'asleep', 'offline'].includes(newState); if (wasMoving && nowStopped) { log.info('Arrival detected!');