albertogeniola / meross-homeassistant

Custom component that leverages the Meross IoT library to integrate with Homeassistant
MIT License
687 stars 76 forks source link

Local-only setup fails on v1.2.10 #469

Open PenguinPofi opened 8 months ago

PenguinPofi commented 8 months ago

Describe the bug Local-only setup fails on version 1.2.10 with a message "An unexpected error occured" after submitting my login info. I am not using a cloud account and want to have everything entirely local. The devices are paired only to the Local Meross Broker, Version 0.0.1-rc0 Going back to version 1.2.5rc5 of Meross-homeassistant - local only setup succeeds and finds all 4 of my mss310 devices successfully. The installation attempts were done back to back, with all same settings/selections, so all variables should be near identical.

Update: upgrading one version at a time resulted in 1.2.6 still working, but 1.2.8 already breaking.

Your environment HomeAssistant version: 2023.10.5 Hassio Version (if applicable): -- PLEASE SPECIFY -- Hardware environment: Raspi 3

Logs taken when the issue happened 2023-10-24 23:09:25.216 ERROR (MainThread) [custom_components.meross_cloud.config_flow] Unable to connect to Meross HTTP api, ex: Failed request to API. Response code: 500 Traceback (most recent call last): File "/config/custom_components/meross_cloud/config_flow.py", line 271, in async_step_configure_manager creds = await self._test_authorization( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/meross_cloud/config_flow.py", line 360, in _test_authorization client = await MerossHttpClient.async_from_user_password( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/meross_iot/http_api.py", line 117, in async_from_user_password creds = await cls.async_login(email=email, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/meross_iot/http_api.py", line 246, in async_login response_data = await MerossHttpClient._async_authenticated_post(url=url, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/meross_iot/http_api.py", line 342, in _async_authenticated_post raise AuthenticatedPostException("Failed request to API. Response code: %s" % str(response.status)) meross_iot.model.http.exception.AuthenticatedPostException: Failed request to API. Response code: 500

albertogeniola commented 8 months ago

Hi @PenguinPofi ,

can you post the logs of the local-addon when this error occurrs?

olivermaor commented 8 months ago

Version 1.2.8 works fine with me.

fireheadman commented 8 months ago

here is a screenshot if this option.... Select the integration... Select local image

enter creds... Unexpected error happens Also not sure what the hostname is referring to... When I put the actual IP addr in, the same error happens image

fireheadman commented 8 months ago
2023-10-31 13:18:41.845 ERROR (MainThread) [custom_components.meross_cloud.config_flow] Unable to connect to Meross HTTP api, ex: Failed request to API. Response code: 500
Traceback (most recent call last):
  File "/config/custom_components/meross_cloud/config_flow.py", line 271, in async_step_configure_manager
    creds = await self._test_authorization(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/meross_cloud/config_flow.py", line 360, in _test_authorization
    client = await MerossHttpClient.async_from_user_password(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/meross_iot/http_api.py", line 117, in async_from_user_password
    creds = await cls.async_login(email=email,
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/meross_iot/http_api.py", line 246, in async_login
    response_data = await MerossHttpClient._async_authenticated_post(url=url,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/meross_iot/http_api.py", line 342, in _async_authenticated_post
    raise AuthenticatedPostException("Failed request to API. Response code: %s" % str(response.status))
meross_iot.model.http.exception.AuthenticatedPostException: Failed request to API. Response code: 500
fireheadman commented 8 months ago

think I understand more about the strange hostname... each time I attempt to configure this integration it creates a different one. I also reverted back to 1.2.5rc5 and that doesn't work either... unsure what to do at this point

2023-10-31 13:29:15.347 INFO (MainThread) [custom_components.meross_cloud.config_flow] Found 2 mdns services.
2023-10-31 13:29:15.347 INFO (MainThread) [custom_components.meross_cloud.config_flow] Found [1] Local Meross API service listening on shield6334.local.:2003
2023-10-31 13:29:15.347 INFO (MainThread) [custom_components.meross_cloud.config_flow] Found [1] Local Meross MQTT service listening on shield6334.local.:2001
2023-10-31 13:29:27.420 ERROR (MainThread) [custom_components.meross_cloud.config_flow] Unable to connect to Meross HTTP api: Invalid username/Password combination

Here is version 1.2.5rc5 logs

2023-10-31 13:31:05.073 INFO (SyncWorker_15) [homeassistant.util.package] Attempting install of meross_iot==0.4.4.7
2023-10-31 13:31:18.258 INFO (MainThread) [custom_components.meross_cloud.version] MerossIot Version: 0.4.5.7
2023-10-31 13:31:18.258 INFO (MainThread) [custom_components.meross_cloud.version] Integration Version: 1.2.5rc5
2023-10-31 13:32:02.596 INFO (MainThread) [custom_components.meross_cloud.config_flow] Found 2 mdns services.
2023-10-31 13:32:02.597 INFO (MainThread) [custom_components.meross_cloud.config_flow] Found [1] Local Meross MQTT service listening on shield4961.local.:2001
2023-10-31 13:32:02.597 INFO (MainThread) [custom_components.meross_cloud.config_flow] Found [1] Local Meross API service listening on shield4961.local.:2003
2023-10-31 13:32:51.643 ERROR (MainThread) [custom_components.meross_cloud.config_flow] Unable to connect to Meross HTTP api: Invalid username/Password combination
fireheadman commented 8 months ago

Another error this time...

2023-10-31 13:39:46.306 ERROR (MainThread) [custom_components.meross_cloud.config_flow] Connection ERROR to HTTP api: Cannot connect to host shield9600.local:2003 ssl:default [Try again]

Is this maybe related to running HA Supervisor in a docker container? I'm on the supported debian 12 version. Or maybe that HA is not running in SSL (http) mode? I do use Nginx Proxy Manager to provide SSL externally ?

albertogeniola commented 8 months ago

Hi guys,

The current version of the add-on is not working with the Meross component due to a change in the MerossIot library. This change was necessary as the Meross team changed the login API and I had to comply with it. This inevitably has side effects also on the addon.

I am currently working on a temporary fix to address this issue. However this will probably require some reconfiguration of the addon.

I'll keep you posted.

Kedryn commented 6 months ago

Any update on this?

jaredcat commented 1 week ago

@albertogeniola any update on this? I'm currently waiting on 1.2.8

I switched to meross specifically to use this with local-only