dmamontov / hass-miwifi

MiWiFi for Home Assistant
https://community.home-assistant.io/t/xiaomi-miwifi-component-for-tracking-devices-and-managing-routers/288734
Apache License 2.0
154 stars 16 forks source link

Unable to connect my MI Wifi Router 4A Gigabit #39

Closed brunob78 closed 2 years ago

brunob78 commented 2 years ago

I'm trying to connect my router MI 4A Gigabit with your integration but it doesn't work. image

I have an error message "Invalid IP". I try also try with IP 192.168.31.1 and have the same issue.

With the DEBUG mode in HA I have catch this informations:

2022-04-07 16:48:20 DEBUG (MainThread) [custom_components.miwifi.luci] Connection error ConnectError('All connection attempts failed') 2022-04-07 16:48:20 DEBUG (MainThread) [custom_components.miwifi.updater] Finished fetching MiWifi updater data in 0.012 seconds (success: True) 2022-04-07 16:48:20 DEBUG (MainThread) [custom_components.miwifi.config_flow] Verify access code: 404 2022-04-07 16:48:32 DEBUG (MainThread) [custom_components.miwifi.luci] Connection error ConnectError('All connection attempts failed') 2022-04-07 16:48:32 DEBUG (MainThread) [custom_components.miwifi.updater] Finished fetching MiWifi updater data in 0.013 seconds (success: True) 2022-04-07 16:48:32 DEBUG (MainThread) [custom_components.miwifi.config_flow] Verify access code: 404 2022-04-07 16:48:56 DEBUG (MainThread) [custom_components.miwifi.luci] Connection error ConnectTimeout('') 2022-04-07 16:48:56 DEBUG (MainThread) [custom_components.miwifi.updater] Finished fetching MiWifi updater data in 7.517 seconds (success: True) 2022-04-07 16:48:56 DEBUG (MainThread) [custom_components.miwifi.config_flow] Verify access code: 404

Could you help me?

dmamontov commented 2 years ago

He was unable to get a fast response from your router. Check the IP and ping your router.

Authorization should take less than 5 seconds.

Try to spot it and send it to me.

brunob78 commented 2 years ago

Ping of the router is OK from terminal on HA image

dmamontov commented 2 years ago

Try going to: http://192.168.31.1/cgi-bin/luci/api/misystem/topo_graph What will give?

dmamontov commented 2 years ago

And the miwifi firmware version is possible?

brunob78 commented 2 years ago

{"show":0,"graph":{"locale":"Home ","ssid":"Xiaomi_Bbo_Verneuil","name":"Xiaomi_Bbo_Verneuil","channel":"release","hardware":"R4A","mode":0,"color":101,"ip":"192.168.31.1"},"code":0}

System versionMAC address Mi Router 4A Giga Version MiWiFi Release 3.0.27

Le jeu. 7 avr. 2022 à 17:13, Dmitry Mamontov @.***> a écrit :

And the miwifi firmware version is possible?

— Reply to this email directly, view it on GitHub https://github.com/dmamontov/hass-miwifi/issues/39#issuecomment-1091863743, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJM4F7OPKB7KNGVOWF4WMDVD33RTANCNFSM5SZVDEXQ . You are receiving this because you authored the thread.Message ID: @.***>

dmamontov commented 2 years ago

On the site I see the latest 2.28.69 http://www1.miwifi.com/miwifi_download.html

I'll try to add a timeout setting and then you can experiment. But on this router, everything works for another person.

brunob78 commented 2 years ago

Ok I'm trying to apply the last firmware and I will inform you of the result after.

I know it works on this router for other people and that's why I don't understand why it doesn't work for me.

Le jeu. 7 avr. 2022 à 17:45, Dmitry Mamontov @.***> a écrit :

On the site I see the latest 2.28.69 http://www1.miwifi.com/miwifi_download.html

I'll try to add a timeout setting and then you can experiment. But on this router, everything works for another person.

— Reply to this email directly, view it on GitHub https://github.com/dmamontov/hass-miwifi/issues/39#issuecomment-1091898153, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJM4F5IELNT2PVEBIPD6SLVD37JLANCNFSM5SZVDEXQ . You are receiving this because you authored the thread.Message ID: @.***>

Sheyla1996 commented 2 years ago

Same error for Mi Router AX1800, when i try config the integration give me a error "Invalid IP"

dmamontov commented 2 years ago

https://github.com/dmamontov/hass-miwifi/releases/tag/v2.2.0

@brunob78 @Sheyla1996 Try updating and changing the timeout

Sheyla1996 commented 2 years ago

I have updated to 2.2.1 and changed the last field to 60 but it still gives the error

dmamontov commented 2 years ago

Can I have a log? debug mode?

brunob78 commented 2 years ago

I have installed the version 2.28.69 but it's chineese version and now I have a lot of difficulties to configure miwifi even with translation.

dmamontov commented 2 years ago

If you find a European one, throw it off, I'll take it apart and see. but I don't think it will make much of a difference.

I need logs from the latest version of the component, they are a little more advanced there. only with debug enabled

you may also have some kind of firewall or something.

Sheyla1996 commented 2 years ago

2022-04-08 11:55:14 DEBUG (MainThread) [custom_components.miwifi.luci] Connection error ConnectTimeout('') 2022-04-08 11:55:14 DEBUG (MainThread) [custom_components.miwifi.updater] Finished fetching MiWifi updater data in 20.009 seconds (success: True) 2022-04-08 11:55:14 DEBUG (MainThread) [custom_components.miwifi.config_flow] Verify access code: 404

dmamontov commented 2 years ago

@Sheyla1996 Install from the latest master. And repeat the game with timeouts.

And send the url to the web interface

Url of authorization page and after authorization

Sheyla1996 commented 2 years ago

I don't get the integration.

I have deleted from HACS the integration, I have restarted HA. I have downloaded the main branch and copied the miwifi folder to the custom_components folder and restarted HA When I go to the integrations I don't get

dmamontov commented 2 years ago

no. just select the beta version in hacs and select the main version there

brunob78 commented 2 years ago

@dmamontov I have installed the version V2.2.0 and my router 4A is on version 2.28.69 and have always an error with timeout to 20

2022-04-08 12:25:37 DEBUG (MainThread) [custom_components.miwifi.luci] Connection error ConnectError('[Errno -3] Try again') 2022-04-08 12:25:37 DEBUG (MainThread) [custom_components.miwifi.updater] Finished fetching MiWifi updater data in 5.015 seconds (success: True) 2022-04-08 12:25:37 DEBUG (MainThread) [custom_components.miwifi.config_flow] Verify access code: 404

dmamontov commented 2 years ago

The name server returned a temporary failure indication. Try again later." Your DNS is acting up.

dmamontov commented 2 years ago

It's definitely not the component. Look towards your DNS

@brunob78 everyone also received the url of the page for authorization and after it

brunob78 commented 2 years ago

@dmamontov for your information, my HA network was 192.168.0.xxx, my Mi 4A router has IP local 192.168.0.106 and the managment console is accesible at 192.168.31.1 I tried to connect the integration with both IPs without success. I tried with the IP alone but also by adding http:// in front of the IP I have

dmamontov commented 2 years ago

Do you have any vpn or proxy turned on yet?

brunob78 commented 2 years ago

My HA was on a domain name and I have a reverse Proxy on my synology NAS

brunob78 commented 2 years ago

even if I tried with my local IP of HA I wasn't able to add the integration

brunob78 commented 2 years ago

From HA I'm not able to ping 192.168.31.1 but I can ping 192.168.0.106 wich is my local IP for MI 4A Router

dmamontov commented 2 years ago

@brunob78

31.1 (ip by default) is correct. And it gives an auto_discovery message, not an integration. and this is not an error that occurs. error below.

Please send full urls

Ping and Access from Python work differently. The standard client is used.

You definitely have a DNS error

https://www.google.com/search?q=Connect+Errno+-3

The only thing I can suggest so far is to try installing the main version from beta and change it with timeouts

brunob78 commented 2 years ago

Ok thanks I'm loooking for DNS error

dmamontov commented 2 years ago

Another option is to deploy a clean portable version of hass on your local PC and check the integration

dmamontov commented 2 years ago

@brunob78 everyone also received the url of the page for authorization and after it

Maybe it will show a little) The important thing is that the api works in the same way as the web interface.

Sheyla1996 commented 2 years ago

Ok I have downloaded the main version from HACS but I can't find the URL you say

dmamontov commented 2 years ago

@Sheyla1996 URL in the browser when you go to the router.

Sheyla1996 commented 2 years ago

http://192.168.31.1/cgi-bin/luci/web

dmamontov commented 2 years ago

@Sheyla1996

You can execute on the server side and send a screenshot

ping 192.168.31.1
telnet 192.168.31.1 80
Sheyla1996 commented 2 years ago

My bug was fixed by going back to version 7.4 of Home Assistant OS. In version 8.0rc1 the wifi does not work

dmamontov commented 2 years ago

@brunob78 Did you manage to solve the problem?

brunob78 commented 2 years ago

No I'm on holiday for 2 weeks.

Le sam. 9 avr. 2022, 14:51, Dmitry Mamontov @.***> a écrit :

@brunob78 https://github.com/brunob78 Did you manage to solve the problem?

— Reply to this email directly, view it on GitHub https://github.com/dmamontov/hass-miwifi/issues/39#issuecomment-1093995032, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASJM4F2ZCYD5KEO6CTWWHPDVEF4MHANCNFSM5SZVDEXQ . You are receiving this because you were mentioned.Message ID: @.***>

effelle commented 2 years ago

I have a similar issue with my AX5 (RA67) in mesh mode, HACS version V2.5. The main router (on 31.1) is recognized but can't be added, the leaf (on 31.43) is registered in Home Assistant without issues.

{"show":1,"graph":{"ssid":"EffE-Domus","color":100,"ip":"192.168.31.1","locale":"Home","name":"XIAOMI-R1","channel":"release","hardware":"RA67",
"mode":4,"leafs":[{"ssid":"EffE-Domus","color":100,"ip":"192.168.31.43","locale":"Guest","name":"Xiaomi-R2","channel":"release","hardware":"RA67","mode":8,"version":""}]},"code":0}

I can ping and access the main router using telnet but the HA integration always returns an invalid IP:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 190, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 150, in _async_update_data
return await self.update_method()
File "/config/custom_components/miwifi/updater.py", line 249, in update
await self._async_prepare(method, self.data)
File "/config/custom_components/miwifi/updater.py", line 376, in _async_prepare
await action(data)
File "/config/custom_components/miwifi/updater.py", line 744, in _async_prepare_device_list
device[ATTR_TRACKER_UPDATER_ENTRY_ID] = integrations[self.ip][
KeyError: '192.168.31.1'

Probably related (?), the leaf router doesn't reports any device connected and some sensors can't be turned on. xiaomi

dmamontov commented 2 years ago

@effelle you have an error, can I have diagnostic data? so that I can fix

effelle commented 2 years ago

I assume you refer to logger info? logs.txt

dmamontov commented 2 years ago

I assume you refer to logger info? logs.txt

Thank you. As I thought. I'll release a fix now.

dmamontov commented 2 years ago

@effelle https://github.com/dmamontov/hass-miwifi/releases/tag/v2.5.1

effelle commented 2 years ago

Sure thing, I'll test it as soon as I'll see it. Will you release it on Beta channel?

dmamontov commented 2 years ago

Sure thing, I'll test it as soon as I'll see it. Will you release it on Beta channel?

Already released) There is no point in beta)

effelle commented 2 years ago

Fixed, thanks Dmitry. I assume I need to wait some time to see some correct stats? xiaomi I have way more device connected and the sensors are still grayed out.

dmamontov commented 2 years ago

@effelle In your screenshot you can see 2 links to download diagnostic data, click on them and send them to me. I'll try to figure it out. Of course, I have ideas about what's going on. But confirmation is needed.

effelle commented 2 years ago

Sure! First link: config_entry-miwifi-b45e9cf2f0559ed023ba806eed022113.json.txt

Second link: config_entry-miwifi-87f5632f06ed5086300a34e5964038b6.json.txt

dmamontov commented 2 years ago

Sure! First link: config_entry-miwifi-b45e9cf2f0559ed023ba806eed022113.json.txt

Second link: config_entry-miwifi-87f5632f06ed5086300a34e5964038b6.json.txt

I need time to study the data. Thank you. I will write as clear as possible.

effelle commented 2 years ago

No need to hurry. Good integration takes time and you already started very well. To complete the picture, here is the list of all the sensors I can't enable for now:

Devices 2.4G
Devices 5G
Devices guest
Devices lan
Wifi 2.4G channel
Wifi 2.4G signal strength
Wifi 5G channel
Wifi 5G signal strength
Wifi 5G
Wifi guest
Dual band
Memory total
Memory usage
Uptime
viktak commented 2 years ago

I have the same router (Xiaomi Mi Router 4A Gigabit Edition) with the same problem ("Invalid IP" when trying to configure this integration). Running OpenWrt 21.02.1 r16325-88151b8303 / LuCI openwrt-21.02 branch git-21.295.67054-13df80d

Let me know if I can help testing.

dmamontov commented 2 years ago

@viktak With pure openwrt, this integration does not work. Only MiWifi (original firmware)