mirror of
https://github.com/teslamate-org/teslamate.git
synced 2026-01-24 21:06:08 +08:00
@@ -161,6 +161,11 @@ defmodule TeslaApi.Stream do
|
||||
Logger.warn("Streaming API Client Error: #{error}")
|
||||
{:close, state}
|
||||
|
||||
%{"value" => "Can't validate token" <> _} ->
|
||||
Logger.warn("Streaming API: Tokens expired")
|
||||
state.receiver.(:tokens_expired)
|
||||
{:ok, state}
|
||||
|
||||
_ ->
|
||||
raise "Client Error: #{inspect(msg)}"
|
||||
end
|
||||
|
||||
@@ -489,7 +489,8 @@ defmodule TeslaMate.Vehicles.Vehicle do
|
||||
|
||||
#### Rest
|
||||
|
||||
def handle_event(:info, {:stream, :too_many_disconnects}, _state, data) do
|
||||
def handle_event(:info, {:stream, msg}, _state, data)
|
||||
when msg in [:too_many_disconnects, :tokens_expired] do
|
||||
Logger.info("Creating new connection … ", car_id: data.car.id)
|
||||
|
||||
ref = Process.monitor(data.stream_pid)
|
||||
|
||||
Reference in New Issue
Block a user