Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Failed to connect. #612

Closed
FeiiiikLV opened this issue Oct 21, 2024 · 82 comments
Closed

[Bug] Failed to connect. #612

FeiiiikLV opened this issue Oct 21, 2024 · 82 comments
Labels
bug Something isn't working

Comments

@FeiiiikLV
Copy link

Describe the bug

Trying to connect to Bambu Cloud. Changed the password in BambuLab to update to new password standards.
Email removed for security.
image

To Reproduce

Install Integration and try to activate it.

Expected Behaviour

I expected to login into Bambu Cloud and add printers with cloud connection

What device are you using?

P1P

Diagnostic Output

Can't, because the Integration isn't active yet.

Log Extracts

No response

Other Information

No response

@FeiiiikLV FeiiiikLV added the bug Something isn't working label Oct 21, 2024
@damian-w
Copy link

Same issue - reset my password and still no luck.

@zhujunsan
Copy link

zhujunsan commented Oct 21, 2024

Same here, I've got errors in logs:

image

image

Edited: My timezone is +8

@marwiak
Copy link

marwiak commented Oct 21, 2024

same for me

@bscheutjens
Copy link

I seem to have the same issue, my logging is being flooded with the same errors as @zhujunsan and the enity "Current stage" shows that my printer is offline. It started at 11:22 AM CEST. Although this might look like Bambu cloud issue, both Bambu Studio and Bamby Handy work perfectly fine.

I'm not sure if it is somehow related, but it started at the same time (to the minute) as I got a notification in Bambu Handy that a print was ready.

@curlydingo
Copy link

curlydingo commented Oct 21, 2024

Same issue here too, but I haven't changed my password or reconfigured the integration lately.

I get a total of 4 different error messages repeating quite rapidly (every ~2 seconds, integration had been running for about 8 minutes at time of screenshot):

image

In the order they appear in that screenshot, the sources are as follows:

custom_components/bambu_lab/pybambu/bambu_client.py:266
custom_components/bambu_lab/pybambu/bambu_client.py:265
custom_components/bambu_lab/pybambu/bambu_client.py:401
custom_components/bambu_lab/pybambu/bambu_client.py:397

No other useful information in the errors as far as I can tell.

Edit: Debug log excerpt follows, IP removed but the rest is unchanged:

2024-10-21 21:52:56.588 DEBUG (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] Connect: Attempting Connection to XXX.XXX.XXX.XXX
2024-10-21 21:52:57.400 DEBUG (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] Starting listen loop
2024-10-21 21:52:57.405 INFO (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] On Connect: Connected to Broker
2024-10-21 21:52:57.405 DEBUG (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] Loading slicer settings...
2024-10-21 21:52:57.405 DEBUG (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] Loading slicer settings
2024-10-21 21:52:57.405 DEBUG (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] Getting slicer settings from Bambu Cloud
2024-10-21 21:52:57.443 DEBUG (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] Received error: 403
2024-10-21 21:52:57.443 ERROR (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] A listener loop thread exception occurred:
2024-10-21 21:52:57.443 ERROR (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] Exception. Type: <class 'ValueError'> Args: 403
2024-10-21 21:52:58.444 WARNING (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] On Disconnect: Disconnected from Broker: 0
2024-10-21 21:52:58.444 WARNING (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] _on_disconnect

Perhaps some sort of cloud auth/API change?

@kurim
Copy link
Contributor

kurim commented Oct 21, 2024

I have the same problem, thought i was blocked by API.

But after login through postman and manual check mqtt with mqttx everything is fine.

@vaderag
Copy link

vaderag commented Oct 21, 2024

I haven't had time to dive in to logs, but noticed that my printer isn't sending info to HA where as it was last week

@systemerror-codenotfound
Copy link

systemerror-codenotfound commented Oct 21, 2024

Same problem here,
no data from the integration and all appear disconnected

Failed to connect when trying to configure it back
Removed the printer and also removed the integration but it's not working and the credentials are 100% fine

Failed to connect. Check credentials.

@robertklep
Copy link

robertklep commented Oct 21, 2024

This also breaks local/LAN mode setups because it's trying to download something from Bambu Cloud, and failing:

2024-10-21 15:30:45.338 DEBUG (P1S-Mqtt-68) [custom_components.bambu_lab.pybambu] Connect: Attempting Connection to 192.168.23.239
2024-10-21 15:30:46.076 DEBUG (P1S-Mqtt-68) [custom_components.bambu_lab.pybambu] Starting listen loop
2024-10-21 15:30:46.079 INFO (P1S-Mqtt-68) [custom_components.bambu_lab.pybambu] On Connect: Connected to Broker
2024-10-21 15:30:46.079 DEBUG (P1S-Mqtt-68) [custom_components.bambu_lab.pybambu] Loading slicer settings...
2024-10-21 15:30:46.079 DEBUG (P1S-Mqtt-68) [custom_components.bambu_lab.pybambu] Loading slicer settings
2024-10-21 15:30:46.079 DEBUG (P1S-Mqtt-68) [custom_components.bambu_lab.pybambu] Getting slicer settings from Bambu Cloud
2024-10-21 15:30:46.119 DEBUG (P1S-Mqtt-68) [custom_components.bambu_lab.pybambu] Received error: 403

I commented out the slicer settings updates that are causing this to get things working again for now (gist of pybambu/bambu_client.py)

@Asakiro
Copy link

Asakiro commented Oct 21, 2024

Same issue here, Login to Cloud failed.
Maybe it's Bambu ..

@formatBCE
Copy link

+1, same on North America, A1 here.

@FWeinb
Copy link

FWeinb commented Oct 21, 2024

Just randomly stopped working for me too, was working fine yesterday evening. P1S, Lan Mode.

[Edit]
Applying this patch to bambu_client.py

300,301c300,301
<         self.bambu_cloud = BambuCloud(region, email, username, auth_token)
<         self.slicer_settings = SlicerSettings(self)
---
>         # self.bambu_cloud = BambuCloud(region, email, username, auth_token)
>         # self.slicer_settings = SlicerSettings(self)
346c346
<         self.slicer_settings.update()
---
>         # self.slicer_settings.update()
487c487
<         self.slicer_settings.update()
---
>         # self.slicer_settings.update()

solves it, but you won't get filament infos anymore. Looks like logging into the bambu account is broken.

@Offpiste84
Copy link

Is stopped working here on A1 in LAN mode.

@feli0x
Copy link

feli0x commented Oct 21, 2024

Just randomly stopped working for me too, was working fine yesterday evening. P1S, Lan Mode.

[Edit]

Applying this patch to bambu_client.py

300,301c300,301

<         self.bambu_cloud = BambuCloud(region, email, username, auth_token)

<         self.slicer_settings = SlicerSettings(self)

---

>         # self.bambu_cloud = BambuCloud(region, email, username, auth_token)

>         # self.slicer_settings = SlicerSettings(self)

346c346

<         self.slicer_settings.update()

---

>         # self.slicer_settings.update()

487c487

<         self.slicer_settings.update()

---

>         # self.slicer_settings.update()

solves it, but you won't get filament infos anymore. Looks like logging into the bambu account is broken.

This worked for me!

@spawnrider
Copy link

Same issue for me on my X1C.

@andybali
Copy link

same here

@mkw1056
Copy link

mkw1056 commented Oct 21, 2024

Same here

@kurim
Copy link
Contributor

kurim commented Oct 21, 2024

Ok i have try to connect with python.
The reason why it does not work is the cloudflare protection.

Response status: 403

<title>Attention Required! | Cloudflare</title> This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.

Rootcause:

requests onyl can http 1.1 instead of http2

this may fix it:

        # Using httpx.Client with http2=True
        with httpx.Client(http2=True) as client:
            response = client.post(url, json=data, timeout=10)

        if not response.is_success:
            LOGGER.debug(f"Received error: {response.status_code}")
            raise ValueError(f"Error: {response.status_code} - {response.text}")

        return response.json()['accessToken']

not tested....

but tbh. py is not my world xD

@AdrianGarside maybe you can help here to solve it

@Menthe11
Copy link

That only checks out for the cloud account and not LAN only mode, right?

@kurim
Copy link
Contributor

kurim commented Oct 21, 2024

Yes the lan mode should work correct if u follow this: #607

@bscheutjens
Copy link

not tested....

but tbh. py is not my world xD

@AdrianGarside maybe you can help here to solve it

I can test that code if you want. The only thing is that I'm completely new to this integration (got my printer last Friday), so I have no idea where to change this code. So if that is something you can tell me, I can change the code and test.

@kurim
Copy link
Contributor

kurim commented Oct 21, 2024

I have try it here:
filebrowser: /homeassistant/custom_components/bambu_lab/pybambu/bambu_cloud.py

But i'm not sure if this works if i just change it and restart hass

@nagi603
Copy link

nagi603 commented Oct 21, 2024

The DDoS of holiday sale probably also nuked their backend API. It started right about the time people started reporting issues.

@Menthe11
Copy link

Menthe11 commented Oct 21, 2024

Just randomly stopped working for me too, was working fine yesterday evening. P1S, Lan Mode.

[Edit]

Applying this patch to bambu_client.py

300,301c300,301

<         self.bambu_cloud = BambuCloud(region, email, username, auth_token)

<         self.slicer_settings = SlicerSettings(self)

---

>         # self.bambu_cloud = BambuCloud(region, email, username, auth_token)

>         # self.slicer_settings = SlicerSettings(self)

346c346

<         self.slicer_settings.update()

---

>         # self.slicer_settings.update()

487c487

<         self.slicer_settings.update()

---

>         # self.slicer_settings.update()

solves it, but you won't get filament infos anymore. Looks like logging into the bambu account is broken.

This worked for me!

Works for me too, apart from the AMS. All slots are empty.

@bscheutjens
Copy link

I have try it here: filebrowser: /homeassistant/custom_components/bambu_lab/pybambu/bambu_cloud.py

But i'm not sure if this works if i just change it and restart hass

I think I changed it in the correct location and restarted HASS. I don't get any (additional) error in the logging, so the change at least doesn't give any compile/run error. However, it does not solve the issue. I'm still getting the same errors as before and I get no data from my printer.

@elemakil
Copy link

elemakil commented Oct 21, 2024

@bscheutjens @kurim

You'd have to replace every use of the requests library targeting the BambuLab API by calls using the httpx API. Or at least, you'd need to replace more than just the login call used to retrieve the accessToken. There seem to be five API calls, all located in bambu_cloud.py.

I did not modify bambu_cloud.py yet because as far as I can tell, my HomeAssistant does not have httpx installed.

@TheDuffman85
Copy link
Contributor

You also need to add httpx as a requirement to the manifest. I can confirm that this fix is working. I'll create a pull request.

@tekierz
Copy link

tekierz commented Oct 22, 2024

Got it working too, if you're seeing an httpx error in your logs, make sure you go into your venv and install httpx from there (my system was on 0.27.2 - but the env was on 0.25)

@AdrianGarside
Copy link
Collaborator

Pushed an official release: https://github.com/greghesp/ha-bambulab/releases/tag/v2.0.23

@jneilliii
Copy link

@AdrianGarside any chance of pushing newest changes to the pybambu repo?

@klausiklau
Copy link

Pushed an official release: https://github.com/greghesp/ha-bambulab/releases/tag/v2.0.23

I just updated HA to 2024.10.3 and also your newest release for ha-bambulab but I do not get any connection. I was testing with older HA version and your Dev release yesterday and this was working fine.

Also MQTT connection is fine when troubleshooting via Postman and MQTTX.

Debug Log attached.

2024-10-23 07:10:19.434 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-10-23 07:10:19.435 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration bambu_lab_p1_spaghetti_detection which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-10-23 07:10:19.436 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration fontawesome which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-10-23 07:10:19.436 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration pirateweather which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-10-23 07:10:19.437 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration bambu_lab which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-10-23 07:10:21.459 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_default_certs with args (<ssl.SSLContext object at 0x145cb2c2ec50>,) inside the event loop by custom integration 'bambu_lab' at custom_components/bambu_lab/pybambu/bambu_client.py, line 332: self.client.tls_set(tls_version=ssl.PROTOCOL_TLS, cert_reqs=ssl.CERT_NONE) (offender: /usr/local/lib/python3.12/site-packages/paho/mqtt/client.py, line 806: context.load_default_certs()), please create a bug report at https://github.com/greghesp/ha-bambulab/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_default_certs
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/usr/src/homeassistant/homeassistant/main.py", line 223, in
sys.exit(main())
File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main
exit_code = runner.run(runtime_conf)
File "/usr/src/homeassistant/homeassistant/runner.py", line 189, in run
return loop.run_until_complete(setup_and_run_hass(runtime_config))
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
self.run_forever()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
self._run_once()
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
handle._run()
File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "/config/custom_components/bambu_lab/coordinator.py", line 131, in listen
self.client.connect(callback=self.event_handler)
File "/config/custom_components/bambu_lab/pybambu/bambu_client.py", line 332, in connect
self.client.tls_set(tls_version=ssl.PROTOCOL_TLS, cert_reqs=ssl.CERT_NONE)

2024-10-23 07:10:21.481 ERROR (MainThread) [homeassistant.components.automation] Automation with alias 'Nuki battery low ' failed to setup triggers and has been disabled: Unknown device 'd052014b0aad19b47d177123378a76a9'
2024-10-23 07:10:26.469 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] A listener loop thread exception occurred:
2024-10-23 07:10:26.470 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] Exception. Type: <class 'socket.gaierror'> Args: [Errno -3] Try again
2024-10-23 07:10:32.475 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] A listener loop thread exception occurred:
2024-10-23 07:10:32.475 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] Exception. Type: <class 'socket.gaierror'> Args: [Errno -3] Try again
2024-10-23 07:10:38.481 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] A listener loop thread exception occurred:
2024-10-23 07:10:38.481 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] Exception. Type: <class 'socket.gaierror'> Args: [Errno -3] Try again
2024-10-23 07:10:44.487 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] A listener loop thread exception occurred:
2024-10-23 07:10:44.487 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] Exception. Type: <class 'socket.gaierror'> Args: [Errno -3] Try again
2024-10-23 07:10:50.493 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] A listener loop thread exception occurred:
2024-10-23 07:10:50.493 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] Exception. Type: <class 'socket.gaierror'> Args: [Errno -3] Try again
2024-10-23 07:10:51.494 DEBUG (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] Connect: Attempting Connection to us.mqtt.bambulab.com
2024-10-23 07:10:53.398 DEBUG (MainThread) [custom_components.bambu_lab]
2024-10-23 07:10:54.821 DEBUG (SyncWorker_4) [custom_components.bambu_lab.pybambu] Getting device list from Bambu Cloud
2024-10-23 07:10:56.500 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] A listener loop thread exception occurred:
2024-10-23 07:10:56.500 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] Exception. Type: <class 'socket.gaierror'> Args: [Errno -3] Try again
2024-10-23 07:10:57.500 DEBUG (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] Connect: Attempting Connection to us.mqtt.bambulab.com
2024-10-23 07:11:02.131 DEBUG (SyncWorker_2) [custom_components.bambu_lab.pybambu] Getting accessToken from Bambu Cloud
2024-10-23 07:11:02.506 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] A listener loop thread exception occurred:
2024-10-23 07:11:02.506 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] Exception. Type: <class 'socket.gaierror'> Args: [Errno -3] Try again
2024-10-23 07:11:03.506 DEBUG (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] Connect: Attempting Connection to us.mqtt.bambulab.com
2024-10-23 07:11:07.144 ERROR (MainThread) [custom_components.bambu_lab] Failed to connect with error code ('[Errno -3] Try again',)
2024-10-23 07:11:08.512 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] A listener loop thread exception occurred:
2024-10-23 07:11:08.512 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] Exception. Type: <class 'socket.gaierror'> Args: [Errno -3] Try again
2024-10-23 07:11:09.513 DEBUG (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] Connect: Attempting Connection to us.mqtt.bambulab.com

Thanks
Philipp

@elemakil
Copy link

I've just updated the integration this morning and I am observing the same errors as reported by @klausiklau.

Prior to updating, I had manually applied a fix to use httpx. This was working fine up until I installed the update.

@AdrianGarside
Copy link
Collaborator

Can you try downgrading to see if things start working again? I’m wondering if things have changed on the Bambu end again such that existing connections to their cloud mqtt kept working until your restarted HA with the update to the integration. The official release is the exact same source as the dev6 release.

@bscheutjens
Copy link

@AdrianGarside, I'm still on dev6 and when I turned on my printer a few minutes ago it was indeed not working. I checked the HA logging and the errors (the same as before) started at the time I turned on the printer.

I also see this new one:

Logger: custom_components.bambu_lab.pybambu
Source: custom_components/bambu_lab/pybambu/bambu_client.py:262
integration: Bambu Lab (documentation, issues)
First occurred: 07:53:00 (1 occurrences)
Last logged: 07:53:00

Exception. Type: <class 'ssl.SSLEOFError'> Args: [SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)

@FeiiiikLV
Copy link
Author

Can you try downgrading to see if things start working again? I’m wondering if things have changed on the Bambu end again such that existing connections to their cloud mqtt kept working until your restarted HA with the update to the integration. The official release is the exact same source as the dev6 release.

Upgraded a few minutes ago, everything lost connection. Now downgraded to dev3, as it was working for me yesterday. Still all the devices are offline, tried to force refers data, it shows 403 error

@Asakiro
Copy link

Asakiro commented Oct 23, 2024

Same Here. Dev Version was working great.. but now even downgrade to dev again doesnt help

@klausiklau
Copy link

Can you try downgrading to see if things start working again? I’m wondering if things have changed on the Bambu end again such that existing connections to their cloud mqtt kept working until your restarted HA with the update to the integration. The official release is the exact same source as the dev6 release.

did try to downgrade both (HA and your addon) but still same issue

@elemakil
Copy link

Digging manually through the API calls one-by-one to me it looks like all except one of them work fine. The API call that fails is the one for "retrieving slicer settings" (around L180 in bambu_cloud.py):

image

@AdrianGarside
Copy link
Collaborator

I can confirm that the issue is the API call to get slicer settings is now returning access denied and the way we handle that is taking down the entire connection. I'll push a quick fix to disable it - custom filaments will be lost until/if we can resolve the access denied error.

@pilo1337
Copy link

pilo1337 commented Oct 23, 2024

works for me though:
image

i wonder, the errors are refering to MQTT connection:

2024-10-23 07:10:57.500 DEBUG (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] Connect: Attempting Connection to us.mqtt.bambulab.com
2024-10-23 07:11:02.131 DEBUG (SyncWorker_2) [custom_components.bambu_lab.pybambu] Getting accessToken from Bambu Cloud
2024-10-23 07:11:02.506 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] A listener loop thread exception occurred:
2024-10-23 07:11:02.506 ERROR (P1S-Mqtt-336) [custom_components.bambu_lab.pybambu] Exception. Type: <class 'socket.gaierror'> Args: [Errno -3] Try again

i have the same errors in my ha installation.

@AdrianGarside
Copy link
Collaborator

https://github.com/greghesp/ha-bambulab/releases/tag/v2.0.24

It seems like there's two issues going on. I'm only seeing the slicer settings issue locally (north america region). The mqtt connection errors above aren't hitting me. For those hitting the mqtt errors - what region are you in?

@klausiklau
Copy link

From Europe

@pilo1337
Copy link

pilo1337 commented Oct 23, 2024

same here, europe, but if i update to 2.0.24, the mqtt error seems to be fixed too..

@AdrianGarside
Copy link
Collaborator

socket.gaierror is a problem resolving the hostname (GetAddressInfo) to connect to.

@bscheutjens
Copy link

The new release works for me, thanks for the quick resolve. I'm not sure about the mqtt errors. I'm also from Europe, but I don't see those errors in my HA log. But I didn't check them before installing 2.0.24, so this might be completely useless information :P

@toupou
Copy link

toupou commented Oct 23, 2024

for me still the same issue.
HA 2024.10.3
Addon: v2.0.24

I do believe the connection issue to us.mqtt.bambulab.com is not working because of this error:

2024-10-23 09:41:47.004 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_default_certs with args (<ssl.SSLContext object at 0x14b84c908ad0>,) inside the event loop by custom integration 'bambu_lab' at custom_components/bambu_lab/pybambu/bambu_client.py, line 332: self.client.tls_set(tls_version=ssl.PROTOCOL_TLS, cert_reqs=ssl.CERT_NONE) (offender: /usr/local/lib/python3.12/site-packages/paho/mqtt/client.py, line 806: context.load_default_certs()), please create a bug report at https://github.com/greghesp/ha-bambulab/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_default_certs

Edit: Region is Europe

@AdrianGarside
Copy link
Collaborator

for me still the same issue. HA 2024.10.3 Addon: v2.0.24

I do believe the connection issue to us.mqtt.bambulab.com is not working because of this error:

2024-10-23 09:41:47.004 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_default_certs with args (<ssl.SSLContext object at 0x14b84c908ad0>,) inside the event loop by custom integration 'bambu_lab' at custom_components/bambu_lab/pybambu/bambu_client.py, line 332: self.client.tls_set(tls_version=ssl.PROTOCOL_TLS, cert_reqs=ssl.CERT_NONE) (offender: /usr/local/lib/python3.12/site-packages/paho/mqtt/client.py, line 806: context.load_default_certs()), please create a bug report at https://github.com/greghesp/ha-bambulab/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_default_certs

Edit: Region is Europe

That's just a warning. Everyone currently gets that with newer home assistant versions. It does not currently affect any of the functionality.

@Spirituss
Copy link

The same is here, it was previously connected. This is the log:

2024-10-23 18:57:44.742 WARNING (MainThread) [homeassistant.components.fan] Entity None (<class 'custom_components.bambu_lab.fan.BambuLabFan'>) does not set FanEntityFeature.TURN_OFF but implements the turn_off method. Please create a bug report at https://github.com/greghesp/ha-bambulab/issues
2024-10-23 18:57:44.742 WARNING (MainThread) [homeassistant.components.fan] Entity None (<class 'custom_components.bambu_lab.fan.BambuLabFan'>) does not set FanEntityFeature.TURN_ON but implements the turn_on method. Please create a bug report at https://github.com/greghesp/ha-bambulab/issues
2024-10-23 18:57:44.744 WARNING (MainThread) [homeassistant.components.fan] Entity None (<class 'custom_components.bambu_lab.fan.BambuLabFan'>) does not set FanEntityFeature.TURN_OFF but implements the turn_off method. Please create a bug report at https://github.com/greghesp/ha-bambulab/issues
2024-10-23 18:57:44.744 WARNING (MainThread) [homeassistant.components.fan] Entity None (<class 'custom_components.bambu_lab.fan.BambuLabFan'>) does not set FanEntityFeature.TURN_ON but implements the turn_on method. Please create a bug report at https://github.com/greghesp/ha-bambulab/issues
2024-10-23 18:57:44.745 WARNING (MainThread) [homeassistant.components.fan] Entity None (<class 'custom_components.bambu_lab.fan.BambuLabFan'>) does not set FanEntityFeature.TURN_OFF but implements the turn_off method. Please create a bug report at https://github.com/greghesp/ha-bambulab/issues
2024-10-23 18:57:44.745 WARNING (MainThread) [homeassistant.components.fan] Entity None (<class 'custom_components.bambu_lab.fan.BambuLabFan'>) does not set FanEntityFeature.TURN_ON but implements the turn_on method. Please create a bug report at https://github.com/greghesp/ha-bambulab/issues
2024-10-23 18:57:44.837 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_default_certs with args (<ssl.SSLContext object at 0x7f6e26c616d0>,) inside the event loop by custom integration 'bambu_lab' at custom_components/bambu_lab/pybambu/bambu_client.py, line 332: self.client.tls_set(tls_version=ssl.PROTOCOL_TLS, cert_reqs=ssl.CERT_NONE) (offender: /usr/local/lib/python3.12/site-packages/paho/mqtt/client.py, line 806: context.load_default_certs()), please create a bug report at https://github.com/greghesp/ha-bambulab/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_default_certs
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 189, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
    handle._run()
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/config/custom_components/bambu_lab/coordinator.py", line 131, in listen
    self.client.connect(callback=self.event_handler)
  File "/config/custom_components/bambu_lab/pybambu/bambu_client.py", line 332, in connect
    self.client.tls_set(tls_version=ssl.PROTOCOL_TLS, cert_reqs=ssl.CERT_NONE)
2024-10-23 18:57:46.207 ERROR (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] A listener loop thread exception occurred:
2024-10-23 18:57:46.207 ERROR (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] Exception. Type: <class 'ValueError'> Args: 403
2024-10-23 18:57:47.209 WARNING (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] On Disconnect: Disconnected from Broker: 0
2024-10-23 18:57:47.209 WARNING (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] _on_disconnect
2024-10-23 18:57:49.099 ERROR (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] A listener loop thread exception occurred:
2024-10-23 18:57:49.099 ERROR (P1S-Mqtt-67) [custom_components.bambu_lab.pybambu] Exception. Type: <class 'ValueError'> Args: 403

@AdrianGarside
Copy link
Collaborator

AdrianGarside commented Oct 23, 2024

Please try v2.0.25-dev1. It has a fix to add user agents in http requests that looks to be required now bambu has deployed cloud flare.

@pilo1337
Copy link

v2.0.25-dev1 seems to work again. updated and flawlessly.

@Spirituss
Copy link

Spirituss commented Oct 23, 2024

@AdrianGarside Thanks, it works for me.
But now there are lot of warnings like this:

2024-10-23 19:51:42.326 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_default_certs with args (<ssl.SSLContext object at 0x7fe7531f43d0>,) inside the event loop by custom integration 'bambu_lab' at custom_components/bambu_lab/pybambu/bambu_client.py, line 332: self.client.tls_set(tls_version=ssl.PROTOCOL_TLS, cert_reqs=ssl.CERT_NONE) (offender: /usr/local/lib/python3.12/site-packages/paho/mqtt/client.py, line 806: context.load_default_certs()), please create a bug report at https://github.com/greghesp/ha-bambulab/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_default_certs
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 189, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
    handle._run()
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/config/custom_components/bambu_lab/coordinator.py", line 131, in listen
    self.client.connect(callback=self.event_handler)
  File "/config/custom_components/bambu_lab/pybambu/bambu_client.py", line 332, in connect
    self.client.tls_set(tls_version=ssl.PROTOCOL_TLS, cert_reqs=ssl.CERT_NONE)

@AdrianGarside
Copy link
Collaborator

That warning isn't blocking currently and there's an issue tracking it.

@AdrianGarside
Copy link
Collaborator

Re-closing since I believe all connectivity issues are currently resolved. The latest dev build (2.0.25-dev1) has a fix to re-enable retrieving custom filaments but is otherwise the same as 2.0.24.

If you are still having connectivity issues, please open a new issue with debug logs.

@AdrianGarside
Copy link
Collaborator

@AdrianGarside any chance of pushing newest changes to the pybambu repo?

I don't have time currently. The big problem I need to fix with the pybambu repo is to cleanup all the member variable usage across the boundary to create a more defensible API boundary. Most of the code just reaches in and uses class member variables directly which means I can make breaking changes far too easily and python doesn't have a compile step to flag those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests