home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.2k stars 30.22k forks source link

Xiaomi Purifier 3H becomes unresponsive every other minute #95062

Open Razer0123 opened 1 year ago

Razer0123 commented 1 year ago

The problem

Xiaomi Purifier 3H becomes unresponsive every other minute, it was not happening in the past, not sure if any update caused this issue

What version of Home Assistant Core has the issue?

core-2023.6.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Xiaomi

Link to integration documentation on our website

No response

Diagnostics information

{ "home_assistant": { "installation_type": "Home Assistant OS", "version": "2023.6.2", "dev": false, "hassio": true, "virtualenv": false, "python_version": "3.11.4", "docker": true, "arch": "armv7l", "timezone": "Europe/Rome", "os_name": "Linux", "os_version": "6.1.21-v7", "supervisor": "2023.06.2", "host_os": "Home Assistant OS 10.3", "docker_version": "23.0.6", "chassis": "embedded", "run_as_root": true }, "custom_components": { "hacs": { "version": "1.32.1", "requirements": [ "aiogithubapi>=22.10.1" ] } }, "integration_manifest": { "domain": "xiaomi_miio", "name": "Xiaomi Miio", "codeowners": [ "@rytilahti", "@syssi", "@starkillerOG" ], "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/xiaomi_miio", "iot_class": "local_polling", "loggers": [ "micloud", "miio" ], "requirements": [ "construct==2.10.56", "micloud==0.5", "python-miio==0.5.12" ], "zeroconf": [ "_miio._udp.local." ], "is_built_in": true }, "data": { "config_entry": { "entry_id": "35bdee5af8bc4821a2d53264492919d2", "version": 1, "domain": "xiaomi_miio", "title": "Mi Air Purifier 3/3H", "data": { "config_flow_device": "device", "host": "192.168.1.197", "token": "REDACTED", "model": "zhimi.airpurifier.mb3", "mac": "REDACTED", "cloud_username": "REDACTED", "cloud_password": "REDACTED", "cloud_country": "de" }, "options": {}, "pref_disable_new_entities": false, "pref_disable_polling": false, "source": "user", "unique_id": "REDACTED", "disabled_by": null }, "coordinator_data": "" } }

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @rytilahti, @syssi, @starkillerog, mind taking a look at this issue as it has been labeled with an integration (xiaomi_miio) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `xiaomi_miio` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign xiaomi_miio` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


xiaomi_miio documentation xiaomi_miio source (message by IssueLinks)

alex3305 commented 1 year ago

Possible duplicate of #65932

shbatm commented 1 year ago

Appear to be having the same issue, don't think it's a duplicate of the same discovery error linked above since the device sets up fine and comes back without intervention, although when it comes in it's reporting as cannot discover briefly (the discovery error above was traced back to a network subnet config issue for me, it has been working fine for a while now).

Logger: homeassistant.components.xiaomi_miio
Source: helpers/update_coordinator.py:229
Integration: Xiaomi Miio (documentation, issues)
First occurred: June 19, 2023 at 2:21:30 PM (158 occurrences)
Last logged: 10:25:41 AM

Error fetching Bedroom Air Purifier data: Unable to discover the device 192.168.30.40

Seems to be going in spurts, so maybe some connectivity issues with the MiHome server causing it to reset (even though it should be local comms from HA to the device)?

It doesn't seem to be an actual network issue though:

Screenshot_20230622_105449_Home Assistant

Screenshot_20230622_105427_Home Assistant

rytilahti commented 1 year ago

Seems to be going in spurts, so maybe some connectivity issues with the MiHome server causing it to reset (even though it should be local comms from HA to the device)?

Some devices are known to have a watchdog that resets the device, are you perhaps blocking their access to the Internet? See https://python-miio.readthedocs.io/en/latest/troubleshooting.html#intermittent-connection-issues-timeouts-xiaomi-vacuum

If this started happen just recently, it might be caused by a new firmware changing how it interacts with the local comms daemon or some network changes you have done locally.

fodi666 commented 1 year ago

In my experience this used to happen a long time ago (one year +). Unfortunately I moved house so I wiped my setup from then, and only added it this week to my current setup. It does the same, becoming unavilable every other minute or so. In the meanwhile it works fine in the Xiaomi app (that's where I used it in the last year). It just clutters the log with all the changes. image

{
  "home_assistant": {
    "installation_type": "Home Assistant OS",
    "version": "2023.6.2",
    "dev": false,
    "hassio": true,
    "virtualenv": false,
    "python_version": "3.11.4",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Budapest",
    "os_name": "Linux",
    "os_version": "6.1.29",
    "supervisor": "2023.06.2",
    "host_os": "Home Assistant OS 10.2",
    "docker_version": "23.0.6",
    "chassis": "vm",
    "run_as_root": true
  },
  "custom_components": {
    "deepstack_face": {
      "version": "0.9.0",
      "requirements": [
        "pillow",
        "deepstack-python==0.8"
      ]
    },
    "hacs": {
      "version": "1.32.1",
      "requirements": [
        "aiogithubapi>=22.10.1"
      ]
    },
    "deepstack_object": {
      "version": "4.6.0",
      "requirements": [
        "pillow",
        "deepstack-python==0.8"
      ]
    },
    "truenas": {
      "version": "0.0.0",
      "requirements": []
    },
    "dual_smart_thermostat": {
      "version": "0.5.5",
      "requirements": []
    },
    "multiscrape": {
      "version": "6.5.0",
      "requirements": [
        "lxml==4.9.1",
        "beautifulsoup4==4.11.1"
      ]
    },
    "xiaomi_miio_airpurifier": {
      "version": "2023.6.0.0",
      "requirements": [
        "construct==2.10.56",
        "python-miio>=0.5.12"
      ]
    },
    "powercalc": {
      "version": "v1.6.7",
      "requirements": [
        "numpy>=1.21.1"
      ]
    },
    "asterisk": {
      "version": "1.0.3",
      "requirements": [
        "asterisk-ami==0.1.6"
      ]
    },
    "browser_mod": {
      "version": "2.2.2",
      "requirements": []
    },
    "babybuddy": {
      "version": "v0.0.0",
      "requirements": []
    },
    "cisco_imc": {
      "version": "v1.0.0",
      "requirements": [
        "imcsdk==0.9.12",
        "iso8601==0.1.12",
        "integrationhelper==0.2.2"
      ]
    },
    "pollen_hu": {
      "version": "0.3.0",
      "requirements": []
    },
    "huawei_solar": {
      "version": "1.2.5",
      "requirements": [
        "huawei-solar==2.2.6"
      ]
    },
    "garbage_collection": {
      "version": "4.10.2",
      "requirements": [
        "python-dateutil>=2.8.2"
      ]
    },
    "blueiris": {
      "version": "1.0.15",
      "requirements": []
    },
    "var": {
      "version": "0.15.0",
      "requirements": []
    }
  },
  "integration_manifest": {
    "domain": "xiaomi_miio",
    "name": "Xiaomi Miio",
    "codeowners": [
      "@rytilahti",
      "@syssi",
      "@starkillerOG"
    ],
    "config_flow": true,
    "documentation": "https://www.home-assistant.io/integrations/xiaomi_miio",
    "iot_class": "local_polling",
    "loggers": [
      "micloud",
      "miio"
    ],
    "requirements": [
      "construct==2.10.56",
      "micloud==0.5",
      "python-miio==0.5.12"
    ],
    "zeroconf": [
      "_miio._udp.local."
    ],
    "is_built_in": true
  },
  "data": {
    "config_entry": {
      "entry_id": "f88024f2519c37f0b8469bbf8e66e53f",
      "version": 1,
      "domain": "xiaomi_miio",
      "title": "Mi Air Purifier 3/3H",
      "data": {
        "config_flow_device": "device",
        "host": "10.1.0.151",
        "token": "**REDACTED**",
        "model": "zhimi.airpurifier.mb3",
        "mac": "**REDACTED**",
        "cloud_username": "**REDACTED**",
        "cloud_password": "**REDACTED**",
        "cloud_country": "de"
      },
      "options": {
        "cloud_subdevices": true
      },
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "unique_id": "**REDACTED**",
      "disabled_by": null
    },
    "coordinator_data": "<AirPurifierMiotStatus anion=None aqi=14 average_aqi=3 buzzer=False buzzer_volume=None child_lock=True fan_level=1 favorite_level=2 favorite_rpm=770 filter_hours_used=1086 filter_left_time=None filter_life_remaining=68 filter_rfid_product_id=xxxx filter_rfid_tag=xxxx filter_type=FilterType.Regular gestures=None humidity=70 is_on=False led=True led_brightness=LedBrightness.Dim led_brightness_level=None mode=OperationMode.Fan motor_speed=0 pm10_density=None power=off purify_volume=100247 temperature=25.7 tvoc=None use_time=3906300>"
  }
}
fodi666 commented 1 year ago

if you know of a way to get it out of a full backup of my 2022.06 system, I can check it if my memory is correct. (I use MariaDB and created a full backup back in the day just before dismatling everything)

KitHubek commented 1 year ago

The same here, all Xiaomi devices like: Fans and Purifiers, gate not affected:

lumi.gateway.mieu01

al time avialable, no unavialable marks.

gate_last 24h

gate_last 7 days

Pufifier 3H zhimi.airpurifier.mb3

3H_last 24h

3H_last 7days

another 3H

3H_2_last 24h

3H_2_last 7b days

3H 30 days:

3H_last 30days

Fan zhimi.fan.za5

fan_last 24h

fan_last 7 days

fan 30 days

and another 3 fans zhimi.fan.za5 the same issue

Razer0123 commented 1 year ago

The only solution i found has been blocking the device from connecting to the internet using the MAC address blocklist filter

Works ok ever since i did

KitHubek commented 1 year ago

ok @Razer0123 but this device will working via Xiaomi Home app or not? I think that this must be connected via XIaomi gate. Am i right?

KitHubek commented 1 year ago

nvm

i tested this solutions, and:

:(

Razer0123 commented 1 year ago

Of course you don’t have to use the Xiaomi app, just pair it with HA, delete the app and block the device using the MAC filter

KitHubek commented 1 year ago

as i wrote and done:

  • this solution not solve problem. All fans and all purifiers still goes uanvialable in HA
Razer0123 commented 1 year ago

as i wrote and done:

  • this solution not solve problem. All fans and all purifiers still goes uanvialable in HA

Not sure how to help, AFAIK this is the only solution at the moment

have you tried restarting HA after blocking the device?

KitHubek commented 1 year ago

no restarted, but can do this now

KitHubek commented 1 year ago

do this again, HA restarted, and the same. Devices still goes unavialable

but, all still connected to my network, i thiink that this isnt problem with devices or my network setup or hardware, I have this problem since many months, but i remember that 2022 this problem not exsist. Some day, some update HA and tons of error at logs and devices goes unavialable till now :(

Razer0123 commented 1 year ago

do this again, HA restarted, and the same. Devices still goes unavialable

but, all still connected to my network, i thiink that this isnt problem with devices or my network setup or hardware, I have this problem since many months, but i remember that 2022 this problem not exsist. Some day, some update HA and tons of error at logs and devices goes unavialable till now :(

Are you using the correct Xiaomi integration? Xiaomi Miio should not be cloud dependant

KitHubek commented 1 year ago

iam using official Xiaomi Miio integration

usedintegr integrsetup

Razer0123 commented 1 year ago

iam using official Xiaomi Miio integration

usedintegr integrsetup

Not really sure how to help then, hope others can

mennokosten commented 1 year ago

Same problem here. Xiaomi MiHome Standing Fan 3 in my case. I've tried everything I can think of

L-E-0-N commented 1 year ago

Same problem here with the Xiaomi Air Purifier 3H

Logger: homeassistant.components.xiaomi_miio Source: helpers/update_coordinator.py:229 Integration: Xiaomi Miio (documentation, issues) First occurred: 18:03:09 (88 occurrences) Last logged: 22:09:55

Error fetching Xiaomi Air Purifier data: Unable to discover the device 192.168.1.233 Timeout fetching Xiaomi Air Purifier data

Unfortunately my router doesn’t allow me to block the device from accessing the internet so I really hope there will be a proper solution for this.

martinhoyer commented 1 year ago

I'm having this problem since forever with the 3H, however now it also happens with the Air Purifier Pro (zhimi.airpurifier.v7) Both of them are blocked from accessing internet. { "home_assistant": { "installation_type": "Home Assistant Container", "version": "2023.7.1", "dev": false, "hassio": false, "virtualenv": false, "python_version": "3.11.4", "docker": true, "arch": "x86_64", "timezone": "Europe/Prague", "os_name": "Linux", "os_version": "5.10.0-21-amd64", "run_as_root": true },

miio-debug-logs.txt

Gruek commented 1 year ago

Same issue here with "Mi Air Purifier 2H" started about 2 days ago with no changes on my end AFAIK. Worked perfectly prior to this.

beaulebens commented 1 year ago

I have this issue also. I was poking around somewhere else and saw reference to someone having a similar problem, which they tracked down to the purifier not wanting to stay connected to anything other than the primary node in a mesh network. I do have a mesh network, although as far as I can tell I have no ability to lock the connection to a specific node, so I'm not really able to verify the issue. Does everyone else here have a mesh network of some sort by any chance?

mennokosten commented 1 year ago

I have this issue also. I was poking around somewhere else and saw reference to someone having a similar problem, which they tracked down to the purifier not wanting to stay connected to anything other than the primary node in a mesh network. I do have a mesh network, although as far as I can tell I have no ability to lock the connection to a specific node, so I'm not really able to verify the issue. Does everyone else here have a mesh network of some sort by any chance?

Yes, I have a mesh network. How would I test this? Force the MiHome device to the main node?

ErectedDK commented 1 year ago

Same issue here. Air Purifier 4 with internet access blocked (rejected not dropped). Router is UDM Pro, and AP is U6-LR. Minimum Data Rate Control on the 2.4GHz network is unchecked. The device becomes unavailable from time to time, around 30 minutes or 1 to 2 times per hour. Same issue with the https://github.com/al-one/hass-xiaomi-miot custom integration. Interestingly, even with Internet access allowed, it still seems to do the same thing.

rytilahti commented 1 year ago

@ErectedDK that's a different issue, I think. I'm wondering if yours is related to the id rollower which would happen on a regular update cycle without any other actions every 40mins or so. You could try enabling debug logging and checking out the "id" in the message payloads around whenever the connection drops.

beaulebens commented 1 year ago

Yes, I have a mesh network. How would I test this? Force the MiHome device to the main node?

Yes, that's what someone did in the thread I reach (which I can't find now).

dirrgang commented 1 year ago

I have the same problem. home-assistant_xiaomi_miio_2023-07-19T07-08-47.361Z.log config_entry-xiaomi_miio-f8d8313c7f02b6541e1ecabcb31d9679.json.txt

Though I've had it ever since I got the device about a year ago. I just kind of put up with it, but it's true, it clogs the logs. Blocking it from the internet doesn't seem to do anything.

mennokosten commented 1 year ago

Yes, I have a mesh network. How would I test this? Force the MiHome device to the main node?

Yes, that's what someone did in the thread I reach (which I can't find now).

I've tried this with my TP-Link Deco m4 mesh network. Connecting the Xiaomi Mihome Standing Fan 3 to the main node. Unfortunately the exact same behavior. Signal keeps dropping same as before. Also blocked internet access for this device, no change (other than Mihome app not being able to connect anymore).

Geronimooo commented 1 year ago

I have the same problem for a humidifier, a purifier and vacuum cleaner. I can ping all these three devices continuously and sometimes they time out for a single ping but otherwise they seem ok even though have pretty high latency.

Is there not a way to increase the timeout of what this module considers as a change of state to "became unavailable"?

KitHubek commented 1 year ago

i think that this is still the same problem as i wrote:

https://github.com/home-assistant/core/issues/89523 https://github.com/home-assistant/core/issues/73763

Gruek commented 1 year ago

Is anyone else here using docker for their homeassistant setup?

I've found that if I restart docker desktop, the devices start responding fine for a while. But over time the timeouts increase in rate until they stop responding altogether, until I restart again.

(I'm using docker desktop for windows)

Might be a docker issue? at least in my case.

deftomat commented 1 year ago

Using Docker. Same issue.

oopiicaa commented 1 year ago

I'm running HA in VMWare, having the same issue (was running it in Python venv on Windows before - also the same issue).

andrekrit commented 1 year ago

I'm experiencing the same problem. Only my Air Purifier 3H is affected. Both the Fan 2 lites and the Fan 3 are running fine, without becoming unresponsive. I'm running Home Assistant 2023.8.2 Supervisor 2023.08.1 Operating System 10.4 Frontend 20230802.0 - latest.

kiwikern commented 1 year ago

Duplicate of #67926 which was closed without solution

oopiicaa commented 1 year ago

I'm experiencing the same problem. Only my Air Purifier 3H is affected. Both the Fan 2 lites and the Fan 3 are running fine,

That goes for me also - have a few Xiaomi devices connected to WiFi and others don't have this issue in HA, just the 3H does.

riccardo1991 commented 1 year ago

Hello, I have the same problem with "zhimi.fan.za3".

On my network firewall I have tried already to:

If in the firewall I put REJECT to the rules I tested, the fan becomes unavailable very often (around 15/20s), while if I put DROP, it is unavailable every minute.

On the contrary, my "zhimi-airpurifier-ma2_miio", is working fine, with just my common IoT firewall rule to block access to WAN interface.

EDIT: I have made some other tests: removing DNS (PiHoles) access from zhimi-airpurifier-ma2_miio corresponded to the frequent "unavailability" on HA, as the Fan. So zhimi-airpurifier-ma2_miio needs just to establish a connection to the DNS server to do not become unavailable. On Piholes I have blocked all "de.ot*.io.mi.com" calls, and there is still the Firewall rule (DROP) to block access to WAN from it. The same config doesn't work for the zhimi.fan.za3. I will try to play with PiHole blocking methods to see if I can trick it as well.

EDIT2: zhimi.fan.za3 keeps becoming unavailable with every PiHole blocking method for de.ot.io.mi.com and de.ots.io.mi.com. The only interesting behavior is when using NODATA blocking method, the fan does a fallback asking the AAAA entry instead of the A one.

home409ca commented 12 months ago

The same for me with the humidifier integration: zhimi.humidifier.cb1

image

oopiicaa commented 12 months ago

Hmm, last (two) comments were apparently deleted, but disabling polling updates for Miio integration does seem to do the trick for me.

deftomat commented 12 months ago

Disabling pooling doesn't work. Yes, it stops showing "unavailable" but the temperature reading is from 3 hour ago.

oopiicaa commented 12 months ago

True ... Didn't even notice as I don't use sensors from 3H ... Today I've added my 3H via custom Xiaomi Miot integration, which doesn't seem to be affected by this issue:

image

This is from Miio integration:

image

Silicon51 commented 11 months ago

Hey Guys, have you checked if it's HA problem? Xiaomi devices could disconnect each 15 mins from Wi-Fi if they do not handshake with their server. https://github.com/rytilahti/python-miio/issues/1049#issuecomment-1321037078 what is funny - it happend to me, but my purifier had connection to xiaomi server

fodi666 commented 11 months ago

I've tried that new Miot automation integration, it works much better with my 3H. It still is unavailable time to time, but maybe once an hour or even less. I can live with that right now. (edit: changed automation to integration)

KitHubek commented 11 months ago

i switched to unofficial Miot integration and everything working much much better. Devices ares unavialable maby 3 or 5 times per 24h, so for me this is very good solution

Razer0123 commented 11 months ago

i switched to unofficial Miot integration and everything working much much better. Devices ares unavialable maby 3 or 5 times per 24h, so for me this is very good solution

How do you control fan speed using the Miot integration? I can't find the way to control fans using automations, only favorite fan speed

pbtsrc commented 10 months ago

The same problem with another zhimi device - Smartmi Evaporative Humidifier 2 (zhimi.humidifier.ca4). Switched to the Miot integration - it works pretty well, but looks less "polished" and has fewer features (no water_tank sensor for example), unfortunately

Razer0123 commented 10 months ago

I've tried that new Miot ~automation~ integration, it works much better with my 3H. It still is unavailable time to time, but maybe once an hour or even less. I can live with that right now. (edit: changed automation to integration)

How do you control fan speed using the Miot integration? I can't find the way to control fans using automations, only favorite fan speed

anondomini commented 9 months ago

Hmm, last (two) comments were apparently deleted, but disabling polling updates for Miio integration does seem to do the trick for me.

Just wanted to confirm that disabling device Updates in Miio integration UI(editing each devices via system preferences for Xiaomi Miio) fixed the issue as well for me. Also it seems that all temperature/humidity sensors are working as expected and reporting current data. Leaving HA versions for those who are following the topic:

HA Core version: 2023.12.4 HA Supervisor version: 2023.12.0 HA os: 11.2

EDIT: Unfortunately, sensors are reporting old values, so it's not working properly as I mentioned previously. However air purifiers stopped reporting as unavailable.

ajpalm commented 8 months ago

Basically the same as everyone else. 3H keeps dropping out, while my other 2 x 2S units hold stable connections.