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

No Longer Able to Find Dehumidifers on Network #165

Closed
mankyd opened this issue Aug 15, 2024 · 7 comments
Closed

No Longer Able to Find Dehumidifers on Network #165

mankyd opened this issue Aug 15, 2024 · 7 comments
Labels

Comments

@mankyd
Copy link

mankyd commented Aug 15, 2024

Version of the custom_component

0.9.4

Configuration

Not sure what to put here - I installed via HACs, clicked "Add Device" in HAss, and then it failed to setup.

Describe the bug

I have two Midea "Cube" dehumidifiers. One was working for a long time. One is new.

They both changed IP addresses, and then nothing I was able to do could get them back into HAss. I tried as much as removing the integration via HACs, rebooting the whole machine, then re-installing.

I have confirmed their ip addresses (now fixed in the router).

Interestingly, just now , if I "excluded" the first one, the second one worked! This is new - before nothing could bring either of them online. However, now I can't figure out how to retry adding the excluded one back.

I still am unable to bring the new one into the system.

I can control both of them readily through Midea's "Smart Home" app, which I believe replaced the "MSmartHome" app?

Debug log


Logger: midea_beautiful.scanner
Source: custom_components/midea_dehumidifier_lan/util.py:227
integration: midea_dehumidifier_lan ([documentation](https://github.com/nbogojevic/homeassistant-midea-air-appliances-lan/blob/main/README.md), [issues](https://github.com/nbogojevic/homeassistant-midea-air-appliances-lan/issues))
First occurred: August 13, 2024 at 19:56:23 (6 occurrences)
Last logged: 12:48:11

Some appliance(s) where not discovered on local network: 1 discovered out of 2
Unable to discover registered appliance {'id': '15063309391****', 'name': 'Laundry Room', 'sn': '000000P0000000Q14435D39E********', 'type': '0xA1', 'modelNumber': ''}

@landocarlesien
Copy link

Same. I uninstalled via HACs. Now it wont let me reinstall.

@mankyd
Copy link
Author

mankyd commented Aug 16, 2024

A little more context and logging:

At this point, both devices appear in my HA setup, but the second one is failing to actually resolve. If I click "configure", I can get the first to work, but the second shows the wrong ip, and when I correct the IP (more on that below) and click "next", it hangs for awhile, before stating: "Invalid username or password (Unable to get valid token for XXXXXXXXXX).

The following also shows up in my logs:

Logger: custom_components.midea_dehumidifier_lan.config_flow
Source: custom_components/midea_dehumidifier_lan/config_flow.py:361
integration: Midea Air Appliances (LAN) ([documentation](https://github.com/nbogojevic/homeassistant-midea-air-appliances-lan/blob/main/README.md), [issues](https://github.com/nbogojevic/homeassistant-midea-air-appliances-lan/issues))
First occurred: 15:58:22 (1 occurrences)
Last logged: 15:58:22

Caught flow exception during appliance step
Traceback (most recent call last):
  File "/config/custom_components/midea_dehumidifier_lan/config_flow.py", line 256, in _validate_appliance
    discovered = self.client.appliance_state(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/midea_dehumidifier_lan/util.py", line 208, in appliance_state
    return midea_beautiful_api.appliance_state(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/midea_beautiful/lan.py", line 1047, in appliance_state
    appliance.identify(cloud, use_cloud)
  File "/usr/local/lib/python3.12/site-packages/midea_beautiful/lan.py", line 788, in identify
    self.valid_token(cloud)
  File "/usr/local/lib/python3.12/site-packages/midea_beautiful/lan.py", line 767, in valid_token
    raise AuthenticationError(
midea_beautiful.exceptions.AuthenticationError: Unable to get valid token for XXXXXXXXX

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/midea_dehumidifier_lan/config_flow.py", line 361, in _async_step_appliance
    discovered = await self.hass.async_add_executor_job(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/midea_dehumidifier_lan/config_flow.py", line 262, in _validate_appliance
    raise _FlowException("invalid_auth", str(ex)) from ex
custom_components.midea_dehumidifier_lan.config_flow._FlowException

Actually, interestingly, I see several logs of it trying to connect to the wrong IP address in general. I know my dehumidifier is is at 10.0.0.66, but I see lots of logs where it keeps trying to connect to 10.0.0.126. Maybe this is the bug?

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/midea_beautiful/lan.py", line 1011, in appliance_state
    response = sock.recv(512)
               ^^^^^^^^^^^^^^
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/midea_dehumidifier_lan/hub.py", line 210, in async_discover_device
    appliance = await self.hass.async_add_executor_job(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/midea_dehumidifier_lan/util.py", line 208, in appliance_state
    return midea_beautiful_api.appliance_state(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/midea_beautiful/lan.py", line 1023, in appliance_state
    raise MideaNetworkError(
midea_beautiful.exceptions.MideaNetworkError: Timeout while connecting to appliance 10.0.0.126:6445

@mankyd
Copy link
Author

mankyd commented Aug 16, 2024

One last update: I was able to edit my .storage/core.config_entries to fix the incorrect IP address. It did not resolve the issue however. I still have the Unable to get valid token error.

@Aqua1ung
Copy link

Already have one Midea smart dehumidifier, and everything's fine with that one as far as HA is concerned. I bought another Midea smart dehumidifier yesterday, but this one is not being detected by HA. At this point I am afraid to uninstall the integration, as rumor has it that I won't be able to reinstall it.

@Aqua1ung
Copy link

Alright, I bit the bullet, uninstalled the MIDEA integration, and reinstalled back on. Old dehumidifier was detected just fine, whereas for the new one I had to specify its IP, and that did it.

Many thanks for a great piece of software!

@mankyd
Copy link
Author

mankyd commented Aug 19, 2024

I found a workaround, and possible a hint at what the bug is:

I noticed everytime I tried to add the second dehumidifier, it would come back with the wrong IP. I think Midea must be caching it somewhere incorrectly?

By removing the dehumidifier in the Midea app, and then re-addding it, this extension straightened itself out.

Specific steps I went through:

  1. Remove the offending dehumidifier from Midea app
  2. Re-add dehumidifer in Midea app
  3. In Hass, use "File Editor" extension to edit .storage/core.config_entries and ensure that the ip address for the offending device is correct. [This step might not be necessary]
  4. Restart Hass. [This step might not be necessary]
  5. Open this integration and click "Configure" to re-configure everything. The IP address finally came back correctly in this step and everything worked!

Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label Oct 19, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants