ekutner / home-connect-hass

Alternative (and improved) Home Connect integration for Home Assistant
MIT License
511 stars 53 forks source link

API call for active program 404 results in excessive number of API calls #233

Closed steve-hodgkiss closed 8 months ago

steve-hodgkiss commented 1 year ago

Keep getting BLOCKED due to excessive number of API calls

I think this is due to the call for the active program for a coffee machine getting 404 and the component constantly retrying. See attached debug log.

Version of the custom_component

0.6.3

Debug log

2023-06-25 21:06:03.329 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/active (try=1 count=663) [404]
2023-06-25 21:06:03.330 DEBUG (MainThread) [home_connect_async.api] API call failed with code=404 error=SDK.Error.NoProgramActive
2023-06-25 21:06:03.330 DEBUG (MainThread) [home_connect_async.appliance] Failed to load active programs with error code=404 key=SDK.Error.NoProgramActive
2023-06-25 21:06:03.331 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/available (try=1 count=664)

2023-06-25.log

lovekull76 commented 1 year ago

I have a similar problem with this add on and a dishwasher. I get blocked almost every day 😐

ekutner commented 1 year ago

It's not just retrying. It is getting notifications about program progres, but there is no active program, so it tries to get it but the API doesn't provide it. See the first line here, this is what's triggering the API call:

2023-06-25 21:06:01.786 DEBUG (MainThread) [home_connect_async.homeconnect] Received event from SSE stream: MessageEvent(type='NOTIFY', message='NOTIFY', data='{"haId":"SIEMENS-CT836LEB6-ABCDEFGHIJKL","items":[{"handling":"none","key":"BSH.Common.Option.ProgramProgress","level":"hint","timestamp":1687637883,"unit":"%","uri":"/api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/active/options/BSH.Common.Option.ProgramProgress","value":11}]}', origin='https://api.home-connect.com', last_event_id='SIEMENS-CT836LEB6-ABCDEFGHIJKL')
2023-06-25 21:06:01.786 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/active (try=1 count=651)

2023-06-25 21:06:01.905 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/active (try=1 count=651) [404]
2023-06-25 21:06:01.905 DEBUG (MainThread) [home_connect_async.api] API call failed with code=404 error=SDK.Error.NoProgramActive
2023-06-25 21:06:01.906 DEBUG (MainThread) [home_connect_async.appliance] Failed to load active programs with error code=404 key=SDK.Error.NoProgramActive

This looks like a bug in Home Connect. I suggest you try to completely remove the appliance from the service and then add it back again. I've see weird issues getting resolved by doing this in the past but YMMV.

steve-hodgkiss commented 1 year ago

Thanks for responding so quickly - have deleted and re-added the machine but still get the 404 error and a lot of API calls.

Back story is I have an automation which turns the machine on, waits for ready state then changes the selected program to espresso using the select program service (but does not actually run the program)

I think the problem is when the machine is turned on, the "active program" is cleaning which when you query the API for details it says no program active as the cleaning function has finished but no program is active (as the machine isn't brewing coffee). "uri":"/api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/active","value":"ConsumerProducts.CoffeeMaker.Program.CleaningModes.ApplianceOnRinsing"}]}. and then when the machine is properly turned on, the component queries the machine again for the active program

2023-06-27 19:34:15.730 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/settings/BSH.Common.Setting.PowerState (try=1 count=2584) [200]
2023-06-27 19:34:15.732 DEBUG (MainThread) [home_connect_async.appliance] Loaded 2 Settings
2023-06-27 19:34:15.732 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.PROGRAM_SELECTED = ConsumerProducts.CoffeeMaker.Program.Beverage.Espresso
2023-06-27 19:34:15.818 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.DATA_CHANGED = None
2023-06-27 19:34:15.858 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Root.SelectedProgram = ConsumerProducts.CoffeeMaker.Program.Beverage.Espresso
2023-06-27 19:34:15.858 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/active (try=1 count=2585)

2023-06-27 19:34:15.902 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/active (try=1 count=2585) [404]
2023-06-27 19:34:15.903 DEBUG (MainThread) [home_connect_async.api] API call failed with code=404 error=SDK.Error.NoProgramActive
2023-06-27 19:34:15.903 DEBUG (MainThread) [home_connect_async.appliance] Failed to load active programs with error code=404 key=SDK.Error.NoProgramActive

Later on when the program selection changes, the component again queries for the active program

2023-06-27 19:34:20.353 DEBUG (MainThread) [home_connect_async.api] HTTP PUT /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/selected (try=1 count=2592) [204]
2023-06-27 19:34:40.925 DEBUG (MainThread) [home_connect_async.homeconnect] Received event from SSE stream: MessageEvent(type='KEEP-ALIVE', message='KEEP-ALIVE', data='', origin='https://api.home-connect.com', last_event_id='SIEMENS-CT836LEB6-ABCDEFGHIJKL')
2023-06-27 19:35:35.926 DEBUG (MainThread) [home_connect_async.homeconnect] Received event from SSE stream: MessageEvent(type='KEEP-ALIVE', message='KEEP-ALIVE', data='', origin='https://api.home-connect.com', last_event_id='SIEMENS-CT836LEB6-ABCDEFGHIJKL')
2023-06-27 19:36:30.925 DEBUG (MainThread) [home_connect_async.homeconnect] Received event from SSE stream: MessageEvent(type='KEEP-ALIVE', message='KEEP-ALIVE', data='', origin='https://api.home-connect.com', last_event_id='SIEMENS-CT836LEB6-ABCDEFGHIJKL')
2023-06-27 19:36:46.333 DEBUG (MainThread) [home_connect_async.homeconnect] Received event from SSE stream: MessageEvent(type='STATUS', message='STATUS', data='{"haId":"SIEMENS-CT836LEB6-ABCDEFGHIJKL","items":[{"handling":"none","key":"BSH.Common.Status.LocalControlActive","level":"hint","timestamp":1687891005,"uri":"/api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/status/BSH.Common.Status.LocalControlActive","value":true}]}', origin='https://api.home-connect.com', last_event_id='SIEMENS-CT836LEB6-ABCDEFGHIJKL')
2023-06-27 19:36:46.334 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Status.LocalControlActive = True
2023-06-27 19:36:48.818 DEBUG (MainThread) [home_connect_async.homeconnect] Received event from SSE stream: MessageEvent(type='STATUS', message='STATUS', data='{"haId":"SIEMENS-CT836LEB6-ABCDEFGHIJKL","items":[{"handling":"none","key":"BSH.Common.Status.OperationState","level":"hint","timestamp":1687891008,"uri":"/api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/status/BSH.Common.Status.OperationState","value":"BSH.Common.EnumType.OperationState.ActionRequired"}]}', origin='https://api.home-connect.com', last_event_id='SIEMENS-CT836LEB6-ABCDEFGHIJKL')
2023-06-27 19:36:48.819 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/active (try=1 count=2593)

2023-06-27 19:36:49.057 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/active (try=1 count=2593) [404]
2023-06-27 19:36:49.058 DEBUG (MainThread) [home_connect_async.api] API call failed with code=404 error=SDK.Error.NoProgramActive
2023-06-27 19:36:49.059 DEBUG (MainThread) [home_connect_async.appliance] Failed to load active programs with error code=404 key=SDK.Error.NoProgramActive
2023-06-27 19:36:49.059 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/selected (try=1 count=2594)

2023-06-27 19:36:49.098 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/selected (try=1 count=2594) [200]
2023-06-27 19:36:49.108 DEBUG (MainThread) [home_connect_async.appliance] Loaded 4 Options for selected/ConsumerProducts.CoffeeMaker.Program.Beverage.Espresso
2023-06-27 19:36:49.109 DEBUG (MainThread) [home_connect_async.appliance] Loaded data for selected Program
2023-06-27 19:36:49.109 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/available (try=1 count=2595)

2023-06-27 19:36:49.157 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/programs/available (try=1 count=2595) [409]
2023-06-27 19:36:49.158 DEBUG (MainThread) [home_connect_async.api] API call failed with code=409 error=SDK.Error.ProgramNotAvailable
2023-06-27 19:36:49.159 DEBUG (MainThread) [home_connect_async.appliance] Failed to load available programs with error code=409 key=SDK.Error.ProgramNotAvailable
2023-06-27 19:36:49.160 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CT836LEB6-ABCDEFGHIJKL/settings (try=1 count=2596)

on another note, there does seem to be a lot of calls for available programs : any chance you could cache the data?

debug log attached... 2023-06-27.log

ekutner commented 1 year ago

That is normal behavior. The problem is when receiving progress notifications, which suggests a program is running, but there is no active program.

steve-hodgkiss commented 1 year ago

Any chance you could see if appliance.py in your async library could remove some of the calls like this (line 299): self.available_programs = await self._async_fetch_programs('available') to see if the number of API calls could be reduced. I would rarely run into blocks with your previous version but hitting this limit a lot more now so wondering if the async library "lost" some of your optimisations.

ekutner commented 1 year ago

This is a complicated issue. Dropping what seems like excessive called may cause unexpected issues in other scenarios, especially considering that the API behavior is not consistent and I have no way of testing most of them. Anyway, as I pointed out, this doesn't seem to be the root cause of your issue but rather progress events being received without an active program.

steve-hodgkiss commented 1 year ago

OK - appreciate whatever you can do. I see the same behaviour with a microwave oven. Component gets BLOCKED in a few minutes once it hits this loop condition (over 400 api calls in 5 mins)

2023-06-28 19:37:35.865 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/commands (try=1 count=3046) [200]
2023-06-28 19:37:35.866 DEBUG (MainThread) [home_connect_async.appliance] Loaded 1 Commands
2023-06-28 19:37:35.867 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.PROGRAM_STARTED = BSH.Common.EnumType.OperationState.Run
2023-06-28 19:37:35.875 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.DATA_CHANGED = None
2023-06-28 19:37:35.894 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Status.OperationState = BSH.Common.EnumType.OperationState.Run
2023-06-28 19:37:35.902 DEBUG (MainThread) [home_connect_async.homeconnect] Received event from SSE stream: MessageEvent(type='NOTIFY', message='NOTIFY', data='{"haId":"SIEMENS-CM878G4B6B-ABCDEFGHIJKL","items":[{"handling":"none","key":"BSH.Common.Root.ActiveProgram","level":"hint","timestamp":1687893344,"uri":"/api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active","value":"Cooking.Oven.Program.Microwave.360Watt"},{"handling":"none","key":"BSH.Common.Option.Duration","level":"hint","timestamp":1687893344,"unit":"seconds","uri":"/api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active/options/BSH.Common.Option.Duration","value":120},{"handling":"none","key":"BSH.Common.Option.StartInRelative","level":"hint","timestamp":1687893344,"unit":"seconds","uri":"/api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active/options/BSH.Common.Option.StartInRelative","value":0},{"handling":"none","key":"BSH.Common.Option.RemainingProgramTime","level":"hint","timestamp":1687893344,"unit":"seconds","uri":"/api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active/options/BSH.Common.Option.RemainingProgramTime","value":120},{"handling":"none","key":"BSH.Common.Option.ElapsedProgramTime","level":"hint","timestamp":1687893344,"unit":"seconds","uri":"/api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active/options/BSH.Common.Option.ElapsedProgramTime","value":0},{"handling":"none","key":"BSH.Common.Option.ProgramProgress","level":"hint","timestamp":1687893344,"unit":"%","uri":"/api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active/options/BSH.Common.Option.ProgramProgress","value":0}]}', origin='https://api.home-connect.com', last_event_id='SIEMENS-CM878G4B6B-ABCDEFGHIJKL')
2023-06-28 19:37:35.903 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active (try=1 count=3047)

2023-06-28 19:37:35.951 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active (try=1 count=3047) [404]
2023-06-28 19:37:35.951 DEBUG (MainThread) [home_connect_async.api] API call failed with code=404 error=SDK.Error.NoProgramActive
2023-06-28 19:37:35.952 DEBUG (MainThread) [home_connect_async.appliance] Failed to load active programs with error code=404 key=SDK.Error.NoProgramActive
2023-06-28 19:37:35.952 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/available (try=1 count=3048)

2023-06-28 19:37:35.998 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/available (try=1 count=3048) [200]
2023-06-28 19:37:35.999 DEBUG (MainThread) [home_connect_async.appliance] Loaded 13 available Programs
2023-06-28 19:37:36.000 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings (try=1 count=3049)

2023-06-28 19:37:36.043 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings (try=1 count=3049) [200]
2023-06-28 19:37:36.044 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.ChildLock (try=1 count=3050)

2023-06-28 19:37:36.201 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.ChildLock (try=1 count=3050) [200]
2023-06-28 19:37:36.203 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.PowerState (try=1 count=3051)

2023-06-28 19:37:36.284 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.PowerState (try=1 count=3051) [200]
2023-06-28 19:37:36.286 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.AlarmClock (try=1 count=3052)

2023-06-28 19:37:36.331 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.AlarmClock (try=1 count=3052) [200]
2023-06-28 19:37:36.333 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/Cooking.Oven.Setting.SabbathMode (try=1 count=3053)

2023-06-28 19:37:36.377 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/Cooking.Oven.Setting.SabbathMode (try=1 count=3053) [200]
2023-06-28 19:37:36.379 DEBUG (MainThread) [home_connect_async.appliance] Loaded 4 Settings
2023-06-28 19:37:36.379 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/commands (try=1 count=3054)

2023-06-28 19:37:36.429 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/commands (try=1 count=3054) [200]
2023-06-28 19:37:36.430 DEBUG (MainThread) [home_connect_async.appliance] Loaded 1 Commands
2023-06-28 19:37:36.430 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.PROGRAM_STARTED = Cooking.Oven.Program.Microwave.360Watt
2023-06-28 19:37:36.439 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.DATA_CHANGED = None
2023-06-28 19:37:36.455 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Root.ActiveProgram = Cooking.Oven.Program.Microwave.360Watt
2023-06-28 19:37:36.455 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Option.Duration = 120
2023-06-28 19:37:36.457 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Option.StartInRelative = 0
2023-06-28 19:37:36.459 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active (try=1 count=3055)

2023-06-28 19:37:36.509 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active (try=1 count=3055) [404]
2023-06-28 19:37:36.509 DEBUG (MainThread) [home_connect_async.api] API call failed with code=404 error=SDK.Error.NoProgramActive
2023-06-28 19:37:36.510 DEBUG (MainThread) [home_connect_async.appliance] Failed to load active programs with error code=404 key=SDK.Error.NoProgramActive
2023-06-28 19:37:36.510 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/available (try=1 count=3056)

2023-06-28 19:37:36.558 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/available (try=1 count=3056) [200]
2023-06-28 19:37:36.559 DEBUG (MainThread) [home_connect_async.appliance] Loaded 13 available Programs
2023-06-28 19:37:36.560 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings (try=1 count=3057)

2023-06-28 19:37:36.607 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings (try=1 count=3057) [200]
2023-06-28 19:37:36.608 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.ChildLock (try=1 count=3058)

2023-06-28 19:37:36.657 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.ChildLock (try=1 count=3058) [200]
2023-06-28 19:37:36.659 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.PowerState (try=1 count=3059)

2023-06-28 19:37:36.701 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.PowerState (try=1 count=3059) [200]
2023-06-28 19:37:36.703 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.AlarmClock (try=1 count=3060)

2023-06-28 19:37:36.762 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.AlarmClock (try=1 count=3060) [200]
2023-06-28 19:37:36.764 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/Cooking.Oven.Setting.SabbathMode (try=1 count=3061)

2023-06-28 19:37:36.816 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/Cooking.Oven.Setting.SabbathMode (try=1 count=3061) [200]
2023-06-28 19:37:36.818 DEBUG (MainThread) [home_connect_async.appliance] Loaded 4 Settings
2023-06-28 19:37:36.819 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/commands (try=1 count=3062)

2023-06-28 19:37:36.866 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/commands (try=1 count=3062) [200]
2023-06-28 19:37:36.867 DEBUG (MainThread) [home_connect_async.appliance] Loaded 1 Commands
2023-06-28 19:37:36.868 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.PROGRAM_STARTED = 120
2023-06-28 19:37:36.885 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.DATA_CHANGED = None
2023-06-28 19:37:36.907 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Option.RemainingProgramTime = 120
2023-06-28 19:37:36.909 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Option.ElapsedProgramTime = 0
2023-06-28 19:37:36.916 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active (try=1 count=3063)

2023-06-28 19:37:36.959 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active (try=1 count=3063) [404]
2023-06-28 19:37:36.960 DEBUG (MainThread) [home_connect_async.api] API call failed with code=404 error=SDK.Error.NoProgramActive
2023-06-28 19:37:36.961 DEBUG (MainThread) [home_connect_async.appliance] Failed to load active programs with error code=404 key=SDK.Error.NoProgramActive
2023-06-28 19:37:36.961 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/available (try=1 count=3064)

2023-06-28 19:37:37.011 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/available (try=1 count=3064) [200]
2023-06-28 19:37:37.012 DEBUG (MainThread) [home_connect_async.appliance] Loaded 13 available Programs
2023-06-28 19:37:37.013 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings (try=1 count=3065)

2023-06-28 19:37:37.080 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings (try=1 count=3065) [200]
2023-06-28 19:37:37.080 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.ChildLock (try=1 count=3066)

2023-06-28 19:37:37.123 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.ChildLock (try=1 count=3066) [200]
2023-06-28 19:37:37.124 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.PowerState (try=1 count=3067)

2023-06-28 19:37:37.167 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.PowerState (try=1 count=3067) [200]
2023-06-28 19:37:37.169 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.AlarmClock (try=1 count=3068)

2023-06-28 19:37:38.290 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.AlarmClock (try=1 count=3068) [200]
2023-06-28 19:37:38.292 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/Cooking.Oven.Setting.SabbathMode (try=1 count=3069)

2023-06-28 19:37:38.617 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/Cooking.Oven.Setting.SabbathMode (try=1 count=3069) [200]
2023-06-28 19:37:38.619 DEBUG (MainThread) [home_connect_async.appliance] Loaded 4 Settings
2023-06-28 19:37:38.619 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/commands (try=1 count=3070)

2023-06-28 19:37:40.205 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/commands (try=1 count=3070) [200]
2023-06-28 19:37:40.206 DEBUG (MainThread) [home_connect_async.appliance] Loaded 1 Commands
2023-06-28 19:37:40.207 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.PROGRAM_STARTED = 0
2023-06-28 19:37:40.217 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.DATA_CHANGED = None
2023-06-28 19:37:40.238 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Option.ProgramProgress = 0
2023-06-28 19:37:40.240 DEBUG (MainThread) [home_connect_async.homeconnect] Received event from SSE stream: MessageEvent(type='STATUS', message='STATUS', data='{"haId":"SIEMENS-CM878G4B6B-ABCDEFGHIJKL","items":[{"handling":"none","key":"Cooking.Oven.Status.CurrentCavityTemperature","level":"hint","timestamp":1687893345,"unit":"°C","uri":"/api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/status/Cooking.Oven.Status.CurrentCavityTemperature","value":22.9999999999999980820}]}', origin='https://api.home-connect.com', last_event_id='SIEMENS-CM878G4B6B-ABCDEFGHIJKL')
2023-06-28 19:37:40.241 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Cooking.Oven.Status.CurrentCavityTemperature = 22.999999999999996
2023-06-28 19:37:40.243 DEBUG (MainThread) [home_connect_async.homeconnect] Received event from SSE stream: MessageEvent(type='NOTIFY', message='NOTIFY', data='{"haId":"SIEMENS-CM878G4B6B-ABCDEFGHIJKL","items":[{"handling":"none","key":"BSH.Common.Option.RemainingProgramTime","level":"hint","timestamp":1687893346,"unit":"seconds","uri":"/api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active/options/BSH.Common.Option.RemainingProgramTime","value":117},{"handling":"none","key":"BSH.Common.Option.ElapsedProgramTime","level":"hint","timestamp":1687893346,"unit":"seconds","uri":"/api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active/options/BSH.Common.Option.ElapsedProgramTime","value":3},{"handling":"none","key":"BSH.Common.Option.ProgramProgress","level":"hint","timestamp":1687893346,"unit":"%","uri":"/api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active/options/BSH.Common.Option.ProgramProgress","value":3}]}', origin='https://api.home-connect.com', last_event_id='SIEMENS-CM878G4B6B-ABCDEFGHIJKL')
2023-06-28 19:37:40.244 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active (try=1 count=3071)

2023-06-28 19:37:40.346 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active (try=1 count=3071) [404]
2023-06-28 19:37:40.346 DEBUG (MainThread) [home_connect_async.api] API call failed with code=404 error=SDK.Error.NoProgramActive
2023-06-28 19:37:40.347 DEBUG (MainThread) [home_connect_async.appliance] Failed to load active programs with error code=404 key=SDK.Error.NoProgramActive
2023-06-28 19:37:40.347 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/available (try=1 count=3072)

2023-06-28 19:37:40.664 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/available (try=1 count=3072) [200]
2023-06-28 19:37:40.666 DEBUG (MainThread) [home_connect_async.appliance] Loaded 13 available Programs
2023-06-28 19:37:40.667 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings (try=1 count=3073)

2023-06-28 19:37:40.727 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings (try=1 count=3073) [200]
2023-06-28 19:37:40.728 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.ChildLock (try=1 count=3074)

2023-06-28 19:37:40.773 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.ChildLock (try=1 count=3074) [200]
2023-06-28 19:37:40.775 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.PowerState (try=1 count=3075)

2023-06-28 19:37:40.820 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.PowerState (try=1 count=3075) [200]
2023-06-28 19:37:40.822 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.AlarmClock (try=1 count=3076)

2023-06-28 19:37:40.868 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.AlarmClock (try=1 count=3076) [200]
2023-06-28 19:37:40.870 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/Cooking.Oven.Setting.SabbathMode (try=1 count=3077)

2023-06-28 19:37:40.917 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/Cooking.Oven.Setting.SabbathMode (try=1 count=3077) [200]
2023-06-28 19:37:40.918 DEBUG (MainThread) [home_connect_async.appliance] Loaded 4 Settings
2023-06-28 19:37:40.919 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/commands (try=1 count=3078)

2023-06-28 19:37:40.967 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/commands (try=1 count=3078) [200]
2023-06-28 19:37:40.968 DEBUG (MainThread) [home_connect_async.appliance] Loaded 1 Commands
2023-06-28 19:37:40.969 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.PROGRAM_STARTED = 117
2023-06-28 19:37:40.978 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.DATA_CHANGED = None
2023-06-28 19:37:40.998 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Option.RemainingProgramTime = 117
2023-06-28 19:37:40.999 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Option.ElapsedProgramTime = 3
2023-06-28 19:37:41.000 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active (try=1 count=3079)

2023-06-28 19:37:41.046 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active (try=1 count=3079) [404]
2023-06-28 19:37:41.047 DEBUG (MainThread) [home_connect_async.api] API call failed with code=404 error=SDK.Error.NoProgramActive
2023-06-28 19:37:41.047 DEBUG (MainThread) [home_connect_async.appliance] Failed to load active programs with error code=404 key=SDK.Error.NoProgramActive
2023-06-28 19:37:41.048 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/available (try=1 count=3080)
steve-hodgkiss commented 1 year ago

Been taking another look at your async library and notice you have this code in appliance.py

            available_programs = await self._async_fetch_programs("available")
            if available_programs:
                self.available_programs = available_programs
                await self._callbacks.async_broadcast_event(self, Events.PAIRED)
                await self._callbacks.async_broadcast_event(self, Events.DATA_CHANGED)
                self._active_program_fail_count = 0
            else:
                # This is a workaround to prevent rate limiting when receiving progress events but avaialable_programs returns 404
                self._active_program_fail_count += 1

It looks like the active_program_fail_count variable only gets incremented when available_programs gets a 404. If you could consider adding this logic to the api call to get the active_program elsewhere in the same block of code then I think it may solve the underlying issue where a 404 is returned by the API even though it tells you a program is currently running.

ekutner commented 1 year ago

That's interesting, I have absolutely no recollection of ever trying to handle this issue but git seems to thinks otherwise :) Anyway, taking a quick look at the code it's not even clear to me what I was trying to do there, so I changed it to something which makes more sense to me now. Unfortunately I can't test it, so it is now in 0.6.4-b1, which you can test and let me know if it improves the rate limit issue. You need to allow beta versions in HACS to see it.

steve-hodgkiss commented 1 year ago

That's great - thanks! I should know in about 48 hours whether this fixes the issue as it crops up fairly regularly. thanks again. Will keep you posted.

steve-hodgkiss commented 1 year ago

Looks like the "404 loop" issue is now resolved. Thanks!

Still get blocked after a few hours. Main culprit is the frequent calls for appliance settings such as this every time a program is selected, program finishes, etc. For example a call for oven settings while I was cooking lunch resulted in over 100 calls as microwave program was started, selected, finished, etc.

2023-07-06 13:24:20.976 DEBUG (MainThread) [home_connect_async.homeconnect] Received event from SSE stream: MessageEvent(type='STATUS', message='STATUS', data='{"haId":"SIEMENS-CM878G4B6B-ABCDEFGHIJKL","items":[{"handling":"none","key":"BSH.Common.Status.LocalControlActive","level":"hint","timestamp":1688646260,"uri":"/api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/status/BSH.Common.Status.LocalControlActive","value":true},{"handling":"none","key":"BSH.Common.Status.OperationState","level":"hint","timestamp":1688646260,"uri":"/api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/status/BSH.Common.Status.OperationState","value":"BSH.Common.EnumType.OperationState.Run"}]}', origin='https://api.home-connect.com', last_event_id='SIEMENS-CM878G4B6B-ABCDEFGHIJKL')
2023-07-06 13:24:20.977 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Status.LocalControlActive = True
2023-07-06 13:24:20.980 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active (try=1 count=608)
2023-07-06 13:24:21.165 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/active (try=1 count=608) [200]
2023-07-06 13:24:21.175 DEBUG (MainThread) [home_connect_async.appliance] Loaded 4 Options for active/Cooking.Oven.Program.Microwave.600Watt
2023-07-06 13:24:21.175 DEBUG (MainThread) [home_connect_async.appliance] Loaded data for active Program
2023-07-06 13:24:21.176 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/available (try=1 count=609)

2023-07-06 13:24:21.224 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/programs/available (try=1 count=609) [200]
2023-07-06 13:24:21.226 DEBUG (MainThread) [home_connect_async.appliance] Loaded 13 available Programs
2023-07-06 13:24:21.270 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings (try=1 count=610) [200]
2023-07-06 13:24:21.271 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.ChildLock (try=1 count=611)

2023-07-06 13:24:21.313 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.ChildLock (try=1 count=611) [200]
2023-07-06 13:24:21.316 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.PowerState (try=1 count=612)

2023-07-06 13:24:21.367 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.PowerState (try=1 count=612) [200]
2023-07-06 13:24:21.369 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.AlarmClock (try=1 count=613)

2023-07-06 13:24:21.408 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/BSH.Common.Setting.AlarmClock (try=1 count=613) [200]
2023-07-06 13:24:21.410 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/Cooking.Oven.Setting.SabbathMode (try=1 count=614)

2023-07-06 13:24:21.458 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/SIEMENS-CM878G4B6B-ABCDEFGHIJKL/settings/Cooking.Oven.Setting.SabbathMode (try=1 count=614) [200]
2023-07-06 13:24:21.459 DEBUG (MainThread) [home_connect_async.appliance] Loaded 4 Settings
ekutner commented 1 year ago

Please upload the full log for me to look at but in general, I haven't figured a consistent way to reduce calls without risking keeping state state data in memory because when you change these things the available options change with them and so it requires refreshing the memory state. If you can point out specific calls which you think are redundant I'll be happy to dig into them deeper.

steve-hodgkiss commented 1 year ago

Here you go - most of the "surplus" calls are for child lock (448 times), sabbath mode (16 times, but basically every time the oven is used), PowerState (637 times), TemperatureUnit (56) Appreciate it's difficult getting the current state of the appliances - that's why I was wondering whether there was any way of caching/throttling some calls for the "basic" settings such as child lock.

2023-07-08 HOME_CONNECT.LOG

Rep-Hueman commented 1 year ago

I also run into a block if the coffee machine is simply operated locally when changing the programs. Now you shouldn't refresh all options for the selected program, but only refresh the option when you want to use it in HA? Options only available if you first select a program in HA eg.

All options available for the active or selected program are always the same for that program! consumerproducts_coffeemaker_option_fillquantity consumerproducts_coffeemaker_option_beanamount consumerproducts_coffeemaker_option_coffeetemperature consumerproducts_coffeemaker_option_flowrate

So you could put this in a file, the same as the translation?

ekutner commented 1 year ago

@code-echobase I've disabled refreshing the settings when the selected program is changed, presumably the two are unrelated. I kept the refresh when the operation state is changing because I suspect some setting may not be available depending on the operation state.

@Rep-Hueman The HA sensors are expected to reflect the correct state at all times, including when the program is selected on the appliance, so it's not possible to only update when selecting a program in HA. Keeping options in a static file is also not possible because the integration is generic and doesn't know anything about any specific appliance. Also HC often change the options they support and a static file will require constant maintenance. There may still be some optimization that can be done there for the in-memory state but it's complicated so I'd rather wait and see if reducing the Settings calls is enough to solve the program for most people.

pbvdven commented 1 year ago

I have recently added a home connect coffeemaker and now im getting blocked all the time i have 2 home connect devices a dishwasher and a coffeemaker but since i added the coffeemaker the home connect alt integration gets blocked all the time. Im using the most recent beta 0.6.4-b2 but the issue stays the same. Please let me know if i can do something to help fix this issue. Thank you

ekutner commented 1 year ago

You can upload a full debug log for at least 48h

pbvdven commented 1 year ago

here is my debug enabled log hopefully you can make something out of it. home-assistant_home_connect_alt_2023-07-30T19-43-34.233Z.log

Please let me know if i can do anything to help. I think it gets blocked when you use the coffee machine not in ha but just the machine it self making drinks switching between different drinks it results in many api calls?? idk? but as soon as you scroll the menu on the machine ha gets updated as well. the dishwasher i use once a day so no problem there and i never hit the limed with only that machine but now with the coffee machine i use it 6/10 times a day different drinks and different settings.

ekutner commented 12 months ago

Thanks. I'll take a look at it but it will have to wait until I return from my vacation towards the end of August.

pbvdven commented 11 months ago

Hi some how i wrote a email to home connect developers support and i got this nice reply from Hubert i dont want to make anyone unhappy but he would like to help you improve your code where possible maybe you would like that? he would also contact you about this that's what he wrote at least.

I hope you don't mind and your enjoying your vacation.

Kind regards, Pim

Reply: Hello Pim.

I'm happy to hear you use our appliances and our Home Connect API.

Generally you're not the first one to observe that with larger number of appliances Home Assistant integration hits our API quota limits and stops functioning properly. Unfortunately this is not a problem of low API limits on our side, but rather inefficient coding on the Home Assistant integration/plugin side. The way it is coded leads to more number of API calls than are really needed, and in case of larger number of appliances it leads to overloading rate limits quotas. We designed our API rate limits to allow using full functionality of the API with large number of appliances as well as safeguarding our cloud infrastructure from malicious or incorrect use.

I will contact the developer of Home Assistant plugin myself (as this is not our product) and try to help him in solving those issues, but please also try to reach him so that he sees there's need for improvement from Home Assistant community as well J

My Email: Hi,

Thanks for taking the time to read this and im sorry for my bad English.

I am having troubles with my home connect home assistant integration. That uses your open api.

It would be nice if home connect can support home assistant for smart home use. My whole house is connected but the main controller is home assistant and i use this awesome integration https://github.com/ekutner/home-connect-hass but after 2 cups of coffee the api gets blocked because you restrict api usage and the coffee machine iq7 makes a lot of those api calls. With one device only a dishwasher it was no problem but now i started to add coffee machine to home connect and a new washer is on the way the api for my account uses to much and gets blocked all the time so its totally useless at the moment Thats not really cool. Maybe you can have a look an maybe fix this issues if not maybe start a payed plan for unlimited api use. Because i now own expensive home connect appliances that are totally useless to me at the moment.

Thanks for you time if i can provide any more information please let me know.

ekutner commented 10 months ago

@pbvdven well, he didn't reach out and I'm not sure he understands how Home Assistant works. Keeping the sensors and options up-to-date requires API calls when certain statuses change. However, if he has any constructive suggestions how to avoid that I'm happy to learn.

ekutner commented 10 months ago

As a lame workaround I added the option to disable certain appliances (see details in the README). The idea is that some appliances, like coffee machines, don't really get a lot of value from being included in HA but they do generate a lot of API calls. Removing them may save a lot of calls without causing a significant loss of functionality.

pbvdven commented 10 months ago

Thanks for the effort it would be nice to only have the power button available I’ve possible.

ekutner commented 10 months ago

@pbvdven I'm afraid that's not going to be possible.

steve-hodgkiss commented 9 months ago

Have created a PR in your async library for you to take a look at.

ekutner commented 9 months ago

Please try version 0.7.0-b1 and let me know if it fixes, or at least improves the issue. That build should make less API calls but I can't really estimate home much less. Note that it is a beta release with some other changes and may have issues.

@steve-hodgkiss please give it a try and compare the number of calls for a given work cycle to the calls make by your PR.

steve-hodgkiss commented 9 months ago

Thanks - initial results after 24 hours look promising. About 600 calls in 24 hours. Will have to go through some old logs to see how it compares.

steve-hodgkiss commented 8 months ago

Closing issue as 0.7 looks to have significantly reduced the number of calls