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
71.71k stars 29.97k forks source link

Mikrotik failed to retrieve data. cmd=[/interface/wifiwave2/print] Error: no such command or directory (wifiwave2) #92168

Closed alex-v-fraser closed 9 months ago

alex-v-fraser commented 1 year ago

The problem

Every time while starting HA I got error: Mikrotik 192.168.1.3 failed to retrieve data. cmd=[/interface/wifiwave2/print] Error: no such command or directory (wifiwave2), no such command prefix

What version of Home Assistant Core has the issue?

core-2023.4.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Mikrotik

Link to integration documentation on our website

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

Diagnostics information

Mikrotik 192.168.1.3 failed to retrieve data. cmd=[/interface/wifiwave2/print] Error: no such command or directory (wifiwave2), no such command prefix

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 @engrbm87, mind taking a look at this issue as it has been labeled with an integration (mikrotik) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `mikrotik` 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 mikrotik` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


mikrotik documentation mikrotik source (message by IssueLinks)

gudvinr commented 1 year ago

wifiwave2 is part of extra packages, it does not come with base routeros package and isn't supported on all routeros devices so it shouldn't be used by default

habalux commented 1 year ago

Looks like the error (which is actually a WARNING level message) is slightly misleading and is caused by the integration just trying to detect wifiwave2 support. I have a 951G-2HnD which is pretty ancient by now and the integration still seems to be working just fine, despite the warning.

WilLlLli commented 1 year ago

I am also encountering this issue and the integration is not working! I'm on RouterOs 7.10.2 with HA on version 2023.7.2. The integration runs but is not reporting the connection state of the currently to the router connected devices:

image

dkmn-123 commented 1 year ago

Same problem here. Mikrotik 7.11, Homeassistant Nothing is shown at the dashboard from the integration

Logger: homeassistant.components.mikrotik.hub Source: components/mikrotik/hub.py:98 Integration: Mikrotik (documentation, issues) First occurred: 12:41:02 AM (2 occurrences) Last logged: 8:19:23 AM

Mikrotik 192.168.x.x failed to retrieve data. cmd=[/system/routerboard/getall] Error: no such command or directory (routerboard), no such command prefix

Chupaka commented 9 months ago

@dkmn-123 and the router model is..?

raffav commented 9 months ago

Sorry don't know how to use GitHub lool, but almost sure from Mikrotik 7.13 the integration is going to breaks as Mikrotik will be renaming wifiwave2 to WIFI also + someother changes to wifi menus @engrbm87

Neo2SHYAlien commented 9 months ago

Since 7.13 (which is still in RC state) more routers support is added for wifiwave2. For example AC^2. I have to remove wireless package and to install wifi-qcom-ac. Defently something is broken 2023-12-05_08-25

The path is changed to /interface/wifi/

> /interface/wifi/print 
Flags: M - MASTER; B - BOUND; R - RUNNING
Columns: NAME, CONFIGURATION.MODE, CHANNEL.WIDTH
#     NAME   CONFIGURATION.MODE  CHANNEL.WIDTH
0 MBR wifi1  ap                  (unknown)    
1 MBR wifi2  ap                  (unknown) 
raffav commented 9 months ago

Since 7.13 (which is still in RC state) more routers support is added for wifiwave2. For example AC^2. I have to remove wireless package and to install wifi-qcom-ac. Defently something is broken 2023-12-05_08-25

The path is changed to /interface/wifi/

> /interface/wifi/print 
Flags: M - MASTER; B - BOUND; R - RUNNING
Columns: NAME, CONFIGURATION.MODE, CHANNEL.WIDTH
#     NAME   CONFIGURATION.MODE  CHANNEL.WIDTH
0 MBR wifi1  ap                  (unknown)    
1 MBR wifi2  ap                  (unknown) 

Not only that, You can run both capsman legacy devices And capsman for wave2 support in the same box.... So Mikrotik integration definitely will break...

Neo2SHYAlien commented 9 months ago

There is a fresh fix (currently I didn’t test it) https://github.com/home-assistant/core/commit/b7bc49b86366ee58971ba1756f354ebc37ee1e28

update: Works fine for my case 😃

engrbm87 commented 9 months ago

PR #104966 added support for wifi command. But I recommend to call this if the firmware version is 7.13 or above. This will help avoid calling unsupported commands which is the base of this reported issue. We already have self.firmware which can be retrieved before calling the other commands. cc @Marco98

Marco98 commented 9 months ago

@engrbm87 I have thought about checking the firmware version to reduce the amount of api calls, but it is more complicated then checking if the version is > 7.12, as it is still possible to install the "wireless" package which replaces /interface/wifi/ with /interface/wireless and /caps-man. I don't know how long the "wireless" package will be supported by Mikrotik. Probably at least another 2-3 Years.

RouterOS 7.13 was released today so maybe this issue is resolved now.

engrbm87 commented 9 months ago

My understanding is v7.13 removes wifwave2 and replaces it with wifi. Are you saying that it is possible to still have wifiwave2 in v7.13? If not, then we should avoid calling wifiwave2 command if firmware is 7.13+

Marco98 commented 9 months ago

No wifiwave2 should be gone after 7.13, but wifi, wireless and caps-man can still occur. But there a lot of edge-cases to be aware of:

command before 7.13 after 7.13
/interface/wireless/ for standalone 802.11ac devices only when "wireless" package is still installed
/caps-man/ for standalone + managed 802.11ac devices only when "wireless" package is still installed
/interface/wifiwave2/ for standalone + managed 802.11ax and some ac devices replaced by /interface/wifi/
/interface/wifi/ n/a default for most 802.11ac+ax devices

In my opinion the cleanest way is to try all 4 possible commands to discover the capabilities, so we don't need to implement the detection for all the edge cases that exist now. I don't think that i even know all the possible combinations as there is still a lot of very old hardware (that probably still runs flawlessly ;) ) in use like @habalux.

I would even go as far as removing the query /system/routerboard/getall for the model, serial number and firmware version, as this command does not add anything useful and is not supported everywhere. For example this is the issue for @dkmn-123. The integration will probably work, but because he is not using a routerboard the integration breaks. If i replace my physical ap-controller with a virtualized one (which is something i am planning on in the next 6-12 Months) the integration will probably also break for me again.

@engrbm87 what is your opinion on this?

Marco98 commented 9 months ago

@Sashik259 could you tell us the model, installed packages and package versions of your RouterOS device, so i can figure out what the right api calls for your case are?

alex-v-fraser commented 9 months ago

@Marco98 Model: RouterBOARD wAP G-5HacT2HnD Current Firmware: 6.49.11 Package List (every package has version 6.49.11):

HA error:

Logger: homeassistant.components.mikrotik.hub
Source: components/mikrotik/hub.py:227 
Integration: Mikrotik (documentation, issues) 
First occurred: 18:56:21 (2 occurrences) 
Last logged: 18:56:21

Mikrotik 192.168.1.3 failed to retrieve data. cmd=[/interface/wifiwave2/print] Error: no such command or directory (wifiwave2), no such command prefix
Mikrotik 192.168.1.3 failed to retrieve data. cmd=[/interface/wifi/print] Error: no such command or directory (wifi), no such command prefix
Chupaka commented 9 months ago

I would suppress error message "no such command prefix" during capabilities discovery...

raffav commented 9 months ago

Not sure if this applies to API call but by terminal mk have created an alias That's is you type interface/wifiwave2/ It will automatically replaced by /interface/wifi They have created this so script doesn't break.

Marco98 commented 9 months ago

@raffav i've already tested this. The alias only applies to the CLI. The API however was broken with v7.13

My opinion on this is the same as @Chupaka. I'll create a patch in the following days that suppresses the "no such comand prefix" error while discovering. This should not only fix this issue, but will also fix the integration, when not running on a routerboard, which is something that @dkmn-123 and i need anyway.

Chupaka commented 9 months ago

@Marco98 maybe it worth running all the commands constantly on the router then? Because it's cheap, and looks like now when I switch, for example, from wireless to CAPsMAN, I'll need [to remember] to restart the integration.

Marco98 commented 9 months ago

@Chupaka rerunning the discovery every time is imo too inefficient and could introduce inconsistency at runtime. Switching between Access Point Configurations at runtime of the integration should be too rare for that case.