al-one / hass-xiaomi-miot

Automatic integrate all Xiaomi devices to HomeAssistant via miot-spec, support Wi-Fi, BLE, ZigBee devices. 小米米家智能家居设备接入Hass集成
https://miot-spec.com
Apache License 2.0
4.73k stars 672 forks source link

Got MiioException while fetching the state: Unable to discover the device #1919

Open tbowmo opened 1 month ago

tbowmo commented 1 month ago

I have an xiaomi e5 robocleaner, that has been working ok using this integration. But the last 3 days it has been unavailable in HA, checking the logs in HA gives me

Logger: custom_components.xiaomi_miot.vacuum
Source: custom_components/xiaomi_miot/__init__.py:1445
integration: Xiaomi Miot Auto ([documentation](https://github.com/al-one/hass-xiaomi-miot), [issues](https://github.com/al-one/hass-xiaomi-miot/issues))
First occurred: 11:00:35 AM (9 occurrences)
Last logged: 11:04:40 AM
Støvsuger(xiaomi.vacuum.c108): Got MiioException while fetching the state: Unable to discover the device 192.168.3.147, mapping: {'vacuum.status': {'siid': 2, 'piid': 1}, 'vacuum.fault': {'siid': 2, 'piid': 2}, 'vacuum.sweep_type': {'siid': 2, 'piid': 4}, 'vacuum.suction_level': {'siid': 2, 'piid': 5}, 'vacuum.cleaning_area': {'siid': 2, 'piid': 6}, 'vacuum.cleaning_time': {'siid': 2, 'piid': 7}, 'vacuum.last_clean_time': {'siid': 2, 'piid': 9}, 'vacuum.order_clean': {'siid': 2, 'piid': 11}, 'vacuum.sweep_break_switch': {'siid': 2, 'piid': 12}, 'time_zone_info.time_zone': {'siid': 15, 'piid': 1}, 'lighting': {'siid': 14, 'piid': 1}, 'notification': {'siid': 12, 'piid': 1}, 'clean_record.total_clean_area': {'siid': 9, 'piid': 1}, 'clean_record.total_clean_time': {'siid': 9, 'piid': 2}, 'clean_record.total_clean_count': {'siid': 9, 'piid': 3}, 'clean_record': {'siid': 9, 'piid': 5}, 'no_disturb': {'siid': 10, 'piid': 1}, 'no_disturb.enable_time_period': {'siid': 10, 'piid': 2}, 'brush_cleaner.brush_life_level': {'siid': 7, 'piid': 1}, 'brush_cleaner.brush_left_time': {'siid': 7, 'piid': 2}, 'filter.filter_life_level': {'siid': 6, 'piid': 1}, 'filter.filter_left_time': {'siid': 6, 'piid': 2}, 'battery_level': {'siid': 3, 'piid': 1}, 'battery.charging_state': {'siid': 3, 'piid': 2}}, max_properties: 8/24

Both devices (HA and the robovac) are in the same vlan, and the machine running HA can ping the robovac without problems. The robovac does not have internet connection (it's on a fenced vlan, only selected devices has access to internet). Note that it was working previously without problems, and I have not done any network changes the last couple of weeks

Installed version is 0.7.21

thegeekybeng commented 1 month ago

Roll back you HA Core. I have managed to replicate the issue thrice with a core update that completely made Mi-ioT defuncted.

Thank goodness for my OCD to do a full back-up weekly.

With that being said, perhaps the more skillful folks could figure out what's breaking Mi-IoT in this manner with the beta Core updates? Meantime i am exiting Beta for now.

tbowmo commented 1 month ago

Not sure that this is something with ha-core, as the core was updated 2 weeks ago. And the robovac has been functioning up until friday.

thegeekybeng commented 1 month ago

Not sure that this is something with ha-core, as the core was updated 2 weeks ago. And the robovac has been functioning up until friday.

that was what i was insistent on initially, until I tried to fix the 7.21 version of Mi Iot and roll back to 7.20 without any success. Had Three AIs helping check out what's wrong and still nothing.

Then i found my Oct Full Working HAOS, restored everything.... and slowly updated all the new integrations one by one ... until i updated core and it broke Mi IoT.

Same thing, I repeated the process, and have the same conclusion. Thus, I left the Beta Channel for now, as there is something not working with Mi Iot.

tbowmo commented 1 month ago

I'm not using any beta channels for software.

Anyways, I got it working, I opened the firewall, and tried using the xiaomi home app on my phone, it didn't work either. So I did a reset of the robovac, repaired it to the xiaomi home app again. It got a new token, that I put into the configs, and now HA can control the robovac again.

It still spews out the error mentioned above very frequently. Looking at the code, it's the network communication to the device that seems to break. Which shouldn't have anything to do with core HA. IF it has, then it's probably because some core network components in python has been updated, at which point this library also ought to be updated accordingly.