Skip to content

Commit be7d0e2

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 bd96e31 commit be7d0e2

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
@@ -525,18 +525,11 @@ defmodule TeslaMate.Vehicles.Vehicle do
525525
end
526526

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

542535
{:keep_state, data,

0 commit comments

Comments
 (0)