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

error at log: Timeout fetching xxx data and device is unavialable for few moments #73763

Closed
KitHubek opened this issue Jun 20, 2022 · 38 comments
Closed

Comments

@KitHubek
Copy link

The problem

See this timeout error at log, and devices are reallly on moment unavialable

Logger: homeassistant.components.xiaomi_miio
Source: helpers/update_coordinator.py:197
Integration: Xiaomi Miio (documentation, issues)
First occurred: 15 czerwca 2022, 08:54:49 (2358 occurrences)
Last logged: 18:16:59

Timeout fetching fan1 data
Timeout fetching purifer1 data
Timeout fetching purifer2 data
Timeout fetching fan2 data
Timeout fetching purifer3 data
Timeout fetching fan3 data

Purifers: 2x Mi 3H EU ver and Mi PRO EU ver
Fans: 3x Smartmi Standing Fan 3

What version of Home Assistant Core has the issue?

2022.6.6

What was the last working version of Home Assistant Core?

2022.4.5

What type of installation are you running?

Home Assistant OS

Integration causing the issue

xiaomi_miio

Link to integration documentation on our website

https://www.home-assistant.io/integrations/xiaomi_miio/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching fan1 data
ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching fan2 data
ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching purifer1 data
ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching fan3 data
ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching purifer2 data
ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching purifer3 data

Additional information

No response

@probot-home-assistant
Copy link

Hey there @rytilahti, @syssi, @starkillerOG, @bieniu, 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!
(message by CodeOwnersMention)


xiaomi_miio documentation
xiaomi_miio source
(message by IssueLinks)

@Maxi2509
Copy link

i have the same with my vacuums i am using.

Logger: homeassistant.components.xiaomi_miio
Source: helpers/update_coordinator.py:197
Integration: Xiaomi Miio
First occurred: 22. Juni 2022, 17:28:13 (5 occurrences)
Last logged: 03:45:23

Timeout fetching roborock.vacuum.s6 data
Timeout fetching Roborock S7 data
Timeout fetching roborock.vacuum.a10 data

@syssi
Copy link
Member

syssi commented Jun 24, 2022

I'm looking for somebody who is able to setup a Home Assistant Core (python virtualenv) instance to compare the behavior of the pure HA core setup with a Home Assistant OS (docker) setup.

@PskNorz
Copy link

PskNorz commented Jul 11, 2022

Same think all the time roborock s5 max goes unaivable all the time.

Logger: homeassistant.components.xiaomi_miio
Source: helpers/update_coordinator.py:211
Integration: Xiaomi Miio
First occurred: 9:46:39 PM (1 occurrences)
Last logged: 9:46:39 PM

Timeout fetching Svetlana data

@lbouriez
Copy link

Hello, same since today with my S5 and S6, they keep becoming unavailable and I have a timeout in the logs:

Logger: homeassistant.components.xiaomi_miio
Source: helpers/update_coordinator.py:211
Integration: Xiaomi Miio (documentation, issues)
First occurred: 4:15:07 PM (8 occurrences)
Last logged: 4:51:47 PM

Timeout fetching Roborock S6 Pure data
Timeout fetching Living Room data

@lbouriez
Copy link

I need more testing but it seems my Unifi Dream machine was blocking some traffic from Xiaomi, that's why my 2 vacuums were having issues.
My settings are these:
image
As soon as I stopped to block, everything is coming back online.
For those having the issues, are you behind ubiquiti hardware ?

@PskNorz
Copy link

PskNorz commented Jul 20, 2022

No i dont got ubiquitu hardware, my set up is simple, just a router but it keeps giving me errors.

Logger: homeassistant.components.xiaomi_miio
Source: helpers/update_coordinator.py:211
Integration: Xiaomi Miio (documentation, issues)
First occurred: July 19, 2022 at 12:06:41 AM (125 occurrences)
Last logged: 9:10:37 AM

Timeout fetching xxxx data

@dawiinci
Copy link

I'm looking for somebody who is able to setup a Home Assistant Core (python virtualenv) instance to compare the behavior of the pure HA core setup with a Home Assistant OS (docker) setup.

I am using a pure python venv installation and have the same issue. In addition the temperature sensors often stay at the same level without any update for way too long.

My system is not reachable from the outside, but that does not apply since the devices are locally anyway (not using the cloud button).

Xiaomi Air purifiers H3 and Pro

@dawiinci
Copy link

The problem with not sending updates seems to be
related to Xiaomi, since they seem to only give an update if the value changes at least 0.5 degree Celsius.

If that is on the plug-in side - which I hope - I would like to change that. Is that possible?

@rytilahti
Copy link
Member

My system is not reachable from the outside, but that does not apply since the devices are locally anyway (not using the cloud button).

Not having them connected to the cloud might be irrelevant, as there are devices that are known to become unresponsive on specific conditions, like on some roborock gen1 firmware vacuums think they are stuck and are rebooted by a watchdog when they are not receiving any responses for their requests. See https://python-miio.readthedocs.io/en/latest/troubleshooting.html#intermittent-connection-issues-timeouts-xiaomi-vacuum for some details on that.

@dawiinci
Copy link

This was may concern. So there is nothing we can do, right? Maybe extending the timeout would be making sense, considering the watchdog has a timeout as well.

@KitHubek
Copy link
Author

KitHubek commented Aug 4, 2022

i agree with @dawiinci maby longer wait for response time will solve or partial solve problem? I have this problem with my three fans and three purifier. I checked and in XIaomi app this devices are all time avialable, so problem with unavialable devices exsist only in HA.

below last 24h, over 800 hits

Adnotacja 2022-08-04 231953

first three are fans fan.zhimi_fan_za5 last two pufifiers zhimi_airpurifier_mb3

Adnotacja 2022-08-04 231502

@Enzokot
Copy link

Enzokot commented Aug 8, 2022

I'm looking for somebody who is able to setup a Home Assistant Core (python virtualenv) instance to compare the behavior of the pure HA core setup with a Home Assistant OS (docker) setup.

@syssi I can help with python virtualenv vs supervized and zhimi.humidifier.ca4, zhimi.humidifier.cb1, roborock.vacuum.s5. What I need to do?

@syssi
Copy link
Member

syssi commented Aug 8, 2022

@Enzokot Thanks for your support! Do you have the same issues mentioned above at your supervized setup?

@Enzokot
Copy link

Enzokot commented Aug 8, 2022

@Enzokot Thanks for your support! Do you have the same issues mentioned above at your supervized setup?

Yes, with all listed devices

@syssi
Copy link
Member

syssi commented Aug 8, 2022

Please pick a debian based host and install the Home Assistant Core in a virtualenv: https://www.home-assistant.io/installation/generic-x86-64#install-dependencies

Please don't use any virtualization. For the test scenario it's important to have a super simple (bare metal) setup. If you have trouble to setup a virtualenv + homeassistant please let me know. I will try to provide support. As soon as the setup (HA core instance) is up and running (accessible via http://a.b.c.d:8123) we will your the Xiaomi devices. Let the setup run a few days, so we can compare the history graphs of both HA instances (virtualenv vs. dockerized=your production system).

@Enzokot
Copy link

Enzokot commented Aug 8, 2022

@syssi I have new installation (without/simple any configs for HA) Home Assistant Core in a virtualenv on Raspbian PI4 and new one (without/simple any configs for HA) Home Assistant Supervized on mini PC like Gygabyte Brix (x86). This is good for testing? May be any tuning for the log file?

@syssi
Copy link
Member

syssi commented Aug 8, 2022

Perfect! So we are good to go. Please add the Xiaomi devices to your new setup. Make sure the setup is able to talk to your MiIO devices and please provide some screenshot (like above #73763 (comment)) of your history graphs. I assume there won't be so much dropouts compared to the supervized setup.

@to4ko
Copy link

to4ko commented Aug 9, 2022

same here - Purifier 2s became unavailable every few seconds
Debian 11, HA Supervised 2022.8.2

image

@fahmietalife
Copy link

Same goes with my mi air purifier 3C, disconnect every few minutes

Logger: homeassistant.components.xiaomi_miio
Source: helpers/update_coordinator.py:151
Integration: Xiaomi Miio (documentation, issues)
First occurred: August 10, 2022 at 8:17:26 PM (55 occurrences)
Last logged: 2:33:26 AM

Timeout fetching Mi Air Purifier 3C data

No issue at all with mi air purifier 3H

@Enzokot
Copy link

Enzokot commented Aug 11, 2022

@syssi result by days
1 day:
1
2 day:
2
3 day:
3

@syssi
Copy link
Member

syssi commented Aug 11, 2022

Good job! It looks like there is no big difference between the setups. The supervized instance shows the same pattern as the virtualenv setup.

@BillyFKidney
Copy link

I need more testing but it seems my Unifi Dream machine was blocking some traffic from Xiaomi, that's why my 2 vacuums were having issues.
My settings are these:
image
As soon as I stopped to block, everything is coming back online.
For those having the issues, are you behind ubiquiti hardware ?

This integration is listed as LOCAL POLLING; why would location block affect the status?

@BillyFKidney
Copy link

2022-08-12 11:39:33.002 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 11:42:11.004 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 11:47:02.004 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 11:56:10.002 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 12:02:50.001 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 12:06:11.003 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 12:11:04.002 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 12:11:37.002 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 12:14:56.002 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 12:17:35.007 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 12:21:06.002 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 12:21:25.006 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 12:27:27.002 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 12:33:16.003 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 12:42:39.003 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 12:59:49.003 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 13:01:50.003 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 13:04:51.003 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 13:06:04.003 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 13:12:00.001 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 13:26:38.002 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 13:39:42.001 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 13:45:32.002 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data
2022-08-12 13:46:50.005 ERROR (MainThread) [homeassistant.components.xiaomi_miio] Timeout fetching zhimi.airpurifier.mb3 data

I'm experiencing the same issue, but there's no pattern to the timing.

Interestingly, Ubiquiti states the device has been connected the entire time.
image

@syssi
Copy link
Member

syssi commented Aug 13, 2022

@BillyFKidney The firmware of some Xiaomi devices is pretty bad. The communication between HA/python-miio is local but the devices tries to talk to the Mi cloud periodically. If the internet access is blocked the firmware gets stuck or runs into timeouts. The local communication slows down or is impossible in these situations.

@KitHubek
Copy link
Author

i have all communication allowed, and last 24h for my fan.zhimi_fan_za5 and two pufifiers zhimi_airpurifier_mb3

Adnotacja 2022-08-13 214014

@syssi
Copy link
Member

syssi commented Aug 13, 2022

@KitHubek There are devices out there which don't like to be polled very frequently. I don't know this fact does apply to your device. I just try to provide a much details as possible here.

@KitHubek
Copy link
Author

last 7 days. Crazy is that Xiaomi purifer PRO has no problem. 7 days i cant see 1 error with purifer PRO. Other devices - no comment

Adnotacja 2022-08-22 001226

@KitHubek
Copy link
Author

KitHubek commented Sep 3, 2022

@syssi

what is the timeout set in the integration after which the device is considered unavailable? I did a regular fan ping test for 3 hours and the duration is max 3 seconds. Of course, the vast majority does not exceed 1s. I think that increasing the waiting time for a reply would solve the problem and it would definitely reduce it significantly

@syssi
Copy link
Member

syssi commented Sep 3, 2022

@KitHubek The default polling timeout is 10 seconds: https://github.com/home-assistant/core/blob/dev/homeassistant/components/xiaomi_miio/__init__.py#L78

IMO there is a difference between: A device responds to ICMP requests (ping) in time vs. the device API is able to respond to a miIO request. You could try to increase the timeout (by editing the file of you HA installation + restart). I assume this won't improve the situation because the miIO device will never respond to some requests.

@KitHubek
Copy link
Author

KitHubek commented Sep 3, 2022

since there are some inquiries to which the device will not answer, maybe it would be worth doing so that the device is simply not marked as unavailable based on these queries, or when available, take into account only those queries that are standard for everyone the type of device, i.e. the state of the on / off switch, ip address, anything else that is always present with each device

@ainslied
Copy link

Please pick a debian based host and install the Home Assistant Core in a virtualenv: https://www.home-assistant.io/installation/generic-x86-64#install-dependencies

Please don't use any virtualization. For the test scenario it's important to have a super simple (bare metal) setup. If you have trouble to setup a virtualenv + homeassistant please let me know. I will try to provide support. As soon as the setup (HA core instance) is up and running (accessible via http://a.b.c.d:8123) we will your the Xiaomi devices. Let the setup run a few days, so we can compare the history graphs of both HA instances (virtualenv vs. dockerized=your production system).

Hi @syssi , I have a core version has described in your message (on a beagle bone black which is a mini PC like the Raspberry PI) and unfortunately I have not the supervised version running in parrallel.

I have sometimes also some unavailabilities (see bellow), and that actually does not bother me. In this example the unavailability is only 22s : so who cares?
image

But there is actually a critical side effect. I don't know if this occurs on the core version only or in all install versions but since these unavailabilities generate "ERRORS" it can break actually the run of other homeassistant processes or the core process itself. For example, if it happends during the startup of homeassistant, it will fail to load (see bellow). It can may be break also other services such as core updates or other critical processes ?
image

So I see actually 2 issues :

  • avoid having this unavailability ERROR (the root cause) which is annoying but may be not critical,
  • catch the error in order to not break other homeassistant processes (critical side effect, at least on the core version).

Do you think I should create a new issue for this : catch the xiaomi_miio error (for example try to generate a warning and not an error?)

Regards,
Ainslie

@KitHubek
Copy link
Author

any update to fix this issue?

@ntkoopman
Copy link

I'm having this issue as well, and I can see the device reconnecting to the wifi in the hostapd logs after ~20 seconds. Since that means the entire connect is reset, it would explain why a timeout wouldn't work. After rebooting the vacuum it seems to be better for now (or maybe it will reconnect if it can't connect to the gateway?).

@rytilahti
Copy link
Member

rytilahti commented Dec 30, 2022

There is #82601 that might improve the situation.

@ntkoopman reconnection to wifi sounds like a device reboot which gives a (potentially useful?) clue that the device has arrived in an unrepairable state causing the reset. The root cause (if not fixed by the linked PR) remains still unknown :-(

@issue-triage-workflows
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@issue-triage-workflows issue-triage-workflows bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 6, 2023
@rytilahti
Copy link
Member

Feel free to give the dev branch a try to see if the #82601 fixes (or at least alleviates) the issue, and please report back, thanks!

@Daneish
Copy link

Daneish commented Apr 8, 2023

Feel free to give the dev branch a try to see if the #82601 fixes (or at least alleviates) the issue, and please report back, thanks!

When testing, do I need to copy the entire xiaomi_miio folder from Dev into my local custom_components folder, or just the changed file (init.py)?

@github-actions github-actions bot locked and limited conversation to collaborators May 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests