Skip to content

Commit 2f1f3fe

Browse files
committed
Fix premature interval logic change in error handler
The interval calculation for API errors was unnecessarily restructured during the read-migration phase. The original case on state was still correct at that point and should have remained unchanged. With simple atoms now in place, the correct form is restored: :driving -> 10 :charging -> 15 :online -> 20 _ -> 30 This is a 4-line case expression instead of the 14-line restructure that was added during read migration.
1 parent cdc7516 commit 2f1f3fe

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)