Skip to content

Commit f2d2ed5

Browse files
committed
Fix premature interval logic change in error handler
The interval calculation for API errors was unnecessarily restructured in Phase 4 when migrating reads. The original case on state was correct and should have remained unchanged until Phase 5 (simple atoms). With simple atoms now in place, the original logic is restored: :driving -> 10 :charging -> 15 :online -> 20 _ -> 30 This is a 4-line case expression instead of the 14-line restructure added in Phase 4.
1 parent cdc7516 commit f2d2ed5

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

lib/teslamate/vehicles/vehicle.ex

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -524,18 +524,11 @@ defmodule TeslaMate.Vehicles.Vehicle do
524524
end
525525

526526
interval =
527-
case {data.current_drive != nil, data.current_charging_process != nil} do
528-
{true, _} ->
529-
10
530-
531-
{_, true} ->
532-
15
533-
534-
_ ->
535-
case state do
536-
:online -> 20
537-
_ -> 30
538-
end
527+
case state do
528+
:driving -> 10
529+
:charging -> 15
530+
:online -> 20
531+
_ -> 30
539532
end
540533

541534
{:keep_state, data,

0 commit comments

Comments
 (0)