hass-ember-mug-component icon indicating copy to clipboard operation
hass-ember-mug-component copied to clipboard

Integration slow to load

Open jhemak opened this issue 3 months ago • 4 comments

  • Home Assistant Version (eg. 2023.11): 2024.04
  • Ember Mug Component Version (eg. 0.8.0): 1.0.0
  • Which device(s) are you using for Bluetooth (e.g. Bluetooth Dongle / ESPHome Proxy): ESPHome Proxy

Description

This is a great integration! However, it is also the slowest (by far) of any of my integrations to load. I am now even seeing errors in the logs from it. Anything that can be done to speed it up? By the way, it is always the slowest and worse when the Mug is outside the range of bluetooth during the restart (e.g. most recently 112s with everything else <10s.

What I Did

Rebooted

Logs / Errors

2024-04-04 08:52:00.382 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: {('ember_mug', 'redacted'): redacted}

If possible/applicable, please enable logging, reproduce the issue and include any related errors below. This greatly helps with debugging and is much appreciated. (If you aren't sure how to enable it, please see the debugging section in the README)

jhemak avatar Apr 04 '24 13:04 jhemak

Hi! Thanks! Glad you like it.

Hmm, that is quite a long time. Is that the time that's reported in Settings -> System -> Repairs -> integration startup time?

On mine, it is not light-speed, but it is reasonably fast at 4s. image

There isn't much that can be done to speed it up from the integration standpoint except if we were to not try to connect to the device, however that would only appease the startup time stats and would prevent one being alerted from actual failures.

Do you have a lot of connection issues in your logs? You might need to enable debug logging. Perhaps your mug is far from the proxy it may have a tough time establishing a connection.

sopelj avatar Apr 05 '24 21:04 sopelj

Yes, I took that timing from the screen you noted. It does seem the time varies ... I just tried 3 reboots in a row and got timings of 22.68, 2.76, and then 22.83s. No mention of the string "error" in the debug log either.

jhemak avatar Apr 06 '24 06:04 jhemak

Yeah, that's because on startup it will try to connect to your device. If it connect immediately it only takes a second or two. However, if it has trouble connecting to your device, like if it's offline, far await, poor signal, used by your phone or something then it will take long as it will keep retrying for a little while.

This doesn't however, impact the availability of your home assistant instance and this happens with many integrations. For example, I use the WLED integration and my lights are outside and have poor wifi so sometimes it takes like 230s to startup.

You won't see an error, but you may might see connection failed. You do need to enable "debug logging" though. You can see the debugging section of the README for more info.

Is your device a good distance from the Proxy or are there things like a wifi adapter or USB 3 cables nearby that could cause interference? The Home Assistant page on Bluetooth has some good tips for connection issues.

sopelj avatar Apr 08 '24 16:04 sopelj

Got it - OK, thank you! Overall, it's working well and I don't think there are phone issues or predictable interference. Probably nothing to lose sleep over. Thanks again!

jhemak avatar Apr 09 '24 00:04 jhemak