krahabb / meross_lan

Home Assistant integration for Meross devices
MIT License
450 stars 47 forks source link

Can't add mts200b - Cannot connect to host 192.168.2.137:80 ssl:default [Connect call failed ('192.168.2.137', 80)] #487

Open jamespreedy opened 2 months ago

jamespreedy commented 2 months ago

Hi folks, hope you're well.

I'm struggling to add my MTS200B thermostat to HASS.

It's set up in HomeKit Home app, and also the iPhone Meross app. It's also auto discovered by the Meross LAN custom_component fine -

Screenshot 2024-09-09 at 5 07 56 PM

It's on the network and I can ping and netcat to it on port 80.

When trying to set it up, it doesn't autodiscover the name for it or any details, and simply pops up a prompt for IP and device key.

Screenshot 2024-09-09 at 5 08 44 PM

The IP is correct, and I've tried using the device key from my Cloud Account entity, but get an error saying it's unable to connect.

Cannot connect to host 192.168.2.137:80 ssl:default [Connect call failed ('192.168.2.137', 80)]

Screenshot 2024-09-09 at 5 12 11 PM

I tried enabling debug logging, but struggled as the device is not yet added. I've also factory reset it, deleted from the various iOS apps and re-added it.

The error mentioned an SSL issue - not sure if it helps, but I spotted a warning in the logs. Unsure if it is related in some way, but figured I'd mention it.

I've set logging to debug and included below - please let me know if I'm able to help with anything else at all.

Thanks!

Detected blocking call to load_default_certs with args (<ssl.SSLContext object at 0x7f8af0871f50>,) inside the event loop by custom integration 'meross_lan' at custom_components/meross_lan/merossclient/mqttclient.py, line 348: self.tls_set(cert_reqs=ssl.CERT_REQUIRED, tls_version=ssl.PROTOCOL_TLS_CLIENT) (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/krahabb/meross_lan/issues

-->

## Version of the custom_component
v5.3.1
Model number - mts200b
Firmware version - 7.6.10.1.6.1
Hardware version - 7.0.0
(Wi-fi signal - 94%)

-->

Add your logs here.

Detected blocking call to load_default_certs with args (<ssl.SSLContext object at 0x7f8af0871f50>,) inside the event loop by custom integration 'meross_lan' at custom_components/meross_lan/merossclient/mqttclient.py, line 348: self.tls_set(cert_reqs=ssl.CERT_REQUIRED, tls_version=ssl.PROTOCOL_TLS_CLIENT) (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/krahabb/meross_lan/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 "/usr/src/homeassistant/homeassistant/config_entries.py", line 752, in async_setup_locked await self.async_setup(hass, integration=integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/meross_lan/__init__.py", line 601, in async_setup_entry await profile.async_init() File "/config/custom_components/meross_lan/meross_profile.py", line 950, in async_init mqttconnection = MerossMQTTConnection(self, broker) File "/config/custom_components/meross_lan/meross_profile.py", line 757, in __init__ MerossMQTTAppClient.__init__( File "/config/custom_components/meross_lan/merossclient/mqttclient.py", line 348, in __init__ self.tls_set(cert_reqs=ssl.CERT_REQUIRED, tls_version=ssl.PROTOCOL_TLS_CLIENT)

Describe the bug

Unable to add mts200b thermostat - get error saying "Cannot connect to host 192.168.2.137:80 ssl:default [Connect call failed ('192.168.2.137', 80)]".

Debug log

Add your logs here.

home-assistant_2024-09-09T16-21-03.378Z.log

krahabb commented 2 months ago

The 'connect call failed' error log appeared here and there in some other similar issues but so far, the reason for this is sadly unknown. As for the 'detected blocking call..' message this is going to be fixed (see #486) but it should be no harm if the HA core devs didn't change their policy with regard to this. It should just be an 'hint' (a strong one tbh) to upgrade the code to use a different approach when calling this I/O intensive operations so to not slow down the main HA core.

FabianGabor commented 3 weeks ago

You did not mention but have you added a Meross cloud profile first into HA?

If your devices are accessible through the Meross app and you have a cloud profile added in HA, everything should be working.

Steps:

  1. add devices through the Meross official app
  2. add your Meross cloud profile into the integration as a hub
  3. all devices should be auto discovered
jamespreedy commented 3 weeks ago

@FabianGabor - thanks for your help mate.

The devices were added through the official Meross app, and the Meross cloud profile was showing in the integration. In the end I chanced my luck, returned the thermostat to Amazon, bought a new one, and was lucky - it just worked!

All 16x thermostats have now been behaving for a few months.

Thanks again! 🍺

krahabb commented 3 weeks ago

These 'bugging' devices here and there were always a part of the 'Meross experience'. I've too returned (some years ago) one new RGB bulb which was apparently working but in the end, the HTTP communication was always struggling to say the least. Substituted with the same model and everything 'just worked'.