File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
33using System . Threading . Tasks ;
4+ using System . Windows ;
45using System . Windows . Threading ;
56using Home_Assistant_Taskbar_Menu . Entities ;
67using Home_Assistant_Taskbar_Menu . Utils ;
@@ -18,11 +19,10 @@ public static void Initialize(Configuration configuration)
1819 HomeAssistantWebsocketClient = new HomeAssistantWebsocketsClient ( Configuration ) ;
1920 }
2021
21- public static async void Recreate ( )
22+ public static void Recreate ( )
2223 {
23- HomeAssistantWebsocketClient ? . Disconnect ( ) ;
24- HomeAssistantWebsocketClient = new HomeAssistantWebsocketsClient ( Configuration ) ;
25- await Start ( ) ;
24+ System . Diagnostics . Process . Start ( Application . ResourceAssembly . Location ) ;
25+ Application . Current . Shutdown ( ) ;
2626 }
2727
2828 public static async Task Start ( )
Original file line number Diff line number Diff line change @@ -95,9 +95,14 @@ public HomeAssistantWebsocketsClient(Configuration configuration)
9595 _websocketClient . ReconnectionHappened . Subscribe ( recInfo =>
9696 {
9797 {
98+ ConsoleWriter . WriteLine ( $ "RECONNECTION HAPPENED: { recInfo . Type } ", ConsoleColor . Yellow ) ;
99+ if ( recInfo . Type == ReconnectionType . NoMessageReceived )
100+ {
101+ HaClientContext . Recreate ( ) ;
102+ }
103+
98104 if ( recInfo . Type != ReconnectionType . Initial )
99105 {
100- ConsoleWriter . WriteLine ( $ "RECONNECTION HAPPENED: { recInfo . Type } ", ConsoleColor . Yellow ) ;
101106 Authenticated = false ;
102107 Authenticate ( ) ;
103108 }
You can’t perform that action at this time.
0 commit comments