@@ -52,22 +52,26 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry):
5252
5353 api .session = ClientSession (connector = api .connector )
5454
55- async def async_update_method ():
55+ async def async_update_method () -> None :
5656 """Fetch both appliances and notifications."""
57+
58+ _LOGGER .debug ("async_update_method called" )
5759 try :
5860 # Geräte abrufen
5961 appliances = await api .get_appliances ()
6062
6163 # Benachrichtigungen abrufen
62- filtered_notifications = [] # await api.fetch_notifications(config_entry)
64+ # await api.fetch_notifications(config_entry)
65+ filtered_notifications = []
6366
6467 # Kombinierte Daten zurückgeben
6568 combined_data = {
6669 "appliances" : appliances ,
6770 "notifications" : filtered_notifications ,
6871 }
6972 except LiebherrUpdateException as e :
70- raise LiebherrUpdateException (f"Error updating Liebherr data: { e } " ) from e
73+ raise LiebherrUpdateException (
74+ f"Error updating Liebherr data: { e } " ) from e
7175 else :
7276 return combined_data
7377
@@ -76,9 +80,11 @@ async def async_update_method():
7680 _LOGGER ,
7781 name = "Liebherr devices" ,
7882 update_method = async_update_method ,
79- update_interval = timedelta (
80- seconds = config_entry .options .get ("update_interval" , 6 )
81- ),
83+ update_interval = timedelta (seconds = 10 ),
84+ )
85+ _LOGGER .debug (
86+ "[LIEBHERR] Effective update interval: %s seconds" ,
87+ coordinator .update_interval .total_seconds (),
8288 )
8389
8490 hass .data [DOMAIN ][config_entry .entry_id ] = {
@@ -149,11 +155,11 @@ async def get_appliances(self):
149155 headers = {
150156 "api-key" : self ._key ,
151157 }
152- _LOGGER .debug (headers )
153- _LOGGER .debug (BASE_API_URL )
158+
154159 async with self .session .get (BASE_API_URL , headers = headers ) as response :
155160 if response .status != 200 :
156- _LOGGER .error ("Failed to fetch appliances: %s" , response .status )
161+ _LOGGER .error ("Failed to fetch appliances: %s" ,
162+ response .status )
157163 return []
158164
159165 data = await response .json ()
@@ -193,7 +199,8 @@ async def get_controls(self, device_id):
193199 _LOGGER .error ("API-KEY provided is not valid" )
194200 return []
195201 data = await response .json ()
196- _LOGGER .debug ("Fetched controls for device %s: %s" , device_id , data )
202+ _LOGGER .debug ("Fetched controls for device %s: %s" ,
203+ device_id , data )
197204 return data
198205
199206 async def set_value (self , deviceId , control , value ):
@@ -244,7 +251,8 @@ async def fetch_notifications(self, config_entry):
244251 notifications = await self .get_notifications ()
245252
246253 # Get selected devices from options
247- selected_devices = config_entry .options .get ("devices_to_notify" , [])
254+ selected_devices = config_entry .options .get (
255+ "devices_to_notify" , [])
248256
249257 # Filter notifications for selected devices
250258 filtered_notifications = [
@@ -350,7 +358,8 @@ async def dismiss_handler(event):
350358 "persistent_notification.dismiss" , dismiss_handler
351359 ).remove ()
352360
353- self ._hass .bus .async_listen ("persistent_notification.dismiss" , dismiss_handler )
361+ self ._hass .bus .async_listen (
362+ "persistent_notification.dismiss" , dismiss_handler )
354363
355364 async def _acknowledge_notification (self , notification ):
356365 """Send acknowledgment to the API."""
0 commit comments