@@ -75,6 +75,13 @@ def get_config_value(self, key, default_type):
7575 """Get config value."""
7676 return default_type (self .config_entry .data .get (key ))
7777
78+ def update_config (self , new_config_entry : ConfigEntry ):
79+ """Update configuration values based on a new config entry."""
80+ _LOGGER .debug ("Updating config for API on port %s" , self .port )
81+ self .send_to_ema = self .get_config_value ("send_to_ema" , bool )
82+ self .message_ignore_age = self .get_config_value ("message_ignore_age" , int )
83+ self .ema_host = self .get_config_value ("ema_host" , str )
84+
7885 async def start (self ) -> bool :
7986 """Start listening socket server."""
8087 try :
@@ -172,8 +179,18 @@ async def data_received(
172179 self .callback (ecu )
173180 except ConnectionResetError :
174181 _LOGGER .warning ("Error: Connection was reset" )
175- except Exception : # noqa: BLE001
176- _LOGGER .warning ("Exception error with %s" , traceback .format_exc ())
182+ except Exception :
183+ _LOGGER .warning (
184+ "Exception error with %s where data is: %s" ,
185+ traceback .format_exc (),
186+ data ,
187+ )
188+ except Exception :
189+ _LOGGER .warning (
190+ "Exception error with %s where data is: %s" ,
191+ traceback .format_exc (), # Formats the exception traceback
192+ data , # The data you're working with
193+ )
177194
178195 def get_model (self , model_code : str ) -> str :
179196 """Get model from model code."""
0 commit comments