tomaae / homeassistant-mikrotik_router

Mikrotik router integration for Home Assistant
Apache License 2.0
302 stars 51 forks source link

Fix for ros 7.13 wireless #332

Closed slackr31337 closed 7 months ago

slackr31337 commented 10 months ago

Proposed change

Update to coordinator for RouterOS > 7.12 with new wifi packages

Type of change

Additional information

Checklist

tomaae commented 9 months ago

Did you test this with wifi/wifi-qcom/wifi-qcom-ac modules disabled or not installed? Not sure how it works in 7.13, but integration may crash in that case.

SkeLLLa commented 9 months ago

@tomaae I just have such device, where neither wifi, nor old wireless package installed. So in the package list there are no packages except routeros.

On routeros >=7.13, if you have no extra wifi packages, the route interface/wifi/registration-table is available, so this fix should work fine. I can doublecheck it on real device through hacs after merging to master or releasing some beta version.

L2jLiga commented 9 months ago

Checked on my CCR1008-8G-1S-1S+

ROS 7.13.0 no wireless package

image

slackr31337 commented 9 months ago

Did you test this with wifi/wifi-qcom/wifi-qcom-ac modules disabled or not installed? Not sure how it works in 7.13, but integration may crash in that case.

Yes, I have tested this on a CRS309-1G-8S+ with only the routeros package installed.

Yamaha0014 commented 9 months ago

Hi is it possible upload corrected file coordinator.py ? On pastebin or another service?

slackr31337 commented 8 months ago

Hi is it possible upload corrected file coordinator.py ? On pastebin or another service?

https://raw.githubusercontent.com/slackr31337/homeassistant-mikrotik_router/ros-7.13/custom_components/mikrotik_router/coordinator.py

ilwalti commented 8 months ago

Nope...

Logger: homeassistant.setup Source: setup.py:251 First occurred: 13:57:29 (1 occurrences) Last logged: 13:57:29

Setup failed for custom integration 'mikrotik_router': Unable to import component: cannot import name 'CONF_SENSOR_NETWATCH_TRACKER' from 'custom_components.mikrotik_router.const' (/config/custom_components/mikrotik_router/const.py) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 251, in _async_setup_component component = integration.get_component() ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/loader.py", line 822, in get_component ComponentProtocol, importlib.import_module(self.pkg_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1204, in _gcd_import File "", line 1176, in _find_and_load File "", line 1147, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "/config/custom_components/mikrotik_router/init.py", line 16, in from .coordinator import MikrotikData, MikrotikCoordinator, MikrotikTrackerCoordinator File "/config/custom_components/mikrotik_router/coordinator.py", line 33, in from .const import ( ImportError: cannot import name 'CONF_SENSOR_NETWATCH_TRACKER' from 'custom_components.mikrotik_router.const' (/config/custom_components/mikrotik_router/const.py)

You have also to add in const.py these two lines:

CONF_SENSOR_NETWATCH_TRACKER = "sensor_netwatch" DEFAULT_SENSOR_NETWATCH_TRACKER = False

after line 60

erkedocara commented 8 months ago

this custom repo didn't worked for me Hap ax 3 ros 7.13 image image

VolodymyrLykhachov commented 8 months ago

It works for me after adding: CONF_SENSOR_NETWATCH_TRACKER = "sensor_netwatch" DEFAULT_SENSOR_NETWATCH_TRACKER = False after line 60 to /config/custom_components/mikrotik_router/const.py

sermayoral commented 8 months ago

You can also switch the mikrotik custom component to master branch in HACS, after that update the coordinator.py file of this branch and restart HA.

M0DDer commented 8 months ago

It works for me after adding: CONF_SENSOR_NETWATCH_TRACKER = "sensor_netwatch" DEFAULT_SENSOR_NETWATCH_TRACKER = False after line 60 to /config/custom_components/mikrotik_router/const.py

With this changes and replace with file at the top of the page all work's fine even at 7.14 beta 6

im-kulikov commented 8 months ago

it works without any changes for me 👍

jajera commented 8 months ago

it worked for me with on hap ax2 after changing to this.

CONF_SENSOR_NETWATCH_TRACKER = "sensor_netwatch"

modified version is at my forked copy https://github.com/jajera/homeassistant-mikrotik_router

namadori commented 8 months ago

@tomaae any timeframe when this pull request will be merged? It's almost 2 months that the solution to #332 is ready and it seems to have been successfully tested by different users.

sidewinder94 commented 8 months ago

I can also confirm that it does fix the issue.

Running HaOS 11.4, with a CRS310-8G+2S+ on firmware 7.13.3 and the wireless package disabled.

Any ETA for merging this ?

tomasz-soltysik commented 8 months ago

@tomaae if this is not planner for merge in upcomming days, could we get this tagged as beta, so that it is easier to get it and also test in different setups?

slackr31337 commented 8 months ago

Is there anything I need to do or am I holding up this merge?

petr-kozak commented 8 months ago

Hi Robert,

what a fast response it is. I was glad to see a solution for the issue I am facing, that was my reaction. But now, when I replace original coordinator.py with your file, I get {"message":"Invalid handler specified"}

Thank you, Petr


From: Robert Dunmire III @.> Sent: Monday, February 5, 2024 1:44 PM To: tomaae/homeassistant-mikrotik_router @.> Cc: petr-kozak @.>; Comment @.> Subject: Re: [tomaae/homeassistant-mikrotik_router] Fix for ros 7.13 wireless (PR #332)

Is there anything I need to do or am I holding up this merge?

— Reply to this email directly, view it on GitHubhttps://github.com/tomaae/homeassistant-mikrotik_router/pull/332#issuecomment-1926916781, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BFRVFBPFVTAXGDIXT4K2TQTYSDHZXAVCNFSM6AAAAABAM2KFZ6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRWHEYTMNZYGE. You are receiving this because you commented.

rinners commented 7 months ago

It works for me after adding: CONF_SENSOR_NETWATCH_TRACKER = "sensor_netwatch" DEFAULT_SENSOR_NETWATCH_TRACKER = False after line 60 to /config/custom_components/mikrotik_router/const.py

Was able to add router, but now showing wireless clients on all APs as "0"

ilwalti commented 7 months ago

Since 2 days ago there is a new (small) problem: every 2/3 minutes, both of my Mikrotik with 7.13.4 OS are marked as non up to date in logfile. The problem resolves itself in a few seconds, but it's annoying... Another router with 6.x RouterOS have no issues. AFAIK, the problem isn't between HA and the router, but between HA and Mikrotik repository, because in integration I see the second line, called "Latest version" to become unknown... (see the attached screenshots)

Screenshot 2024-02-14 110103 Screenshot 2024-02-14 110615

Any ideas?

namadori commented 7 months ago

Since 2 days ago there is a new (small) problem: every 2/3 minutes, both of my Mikrotik with 7.13.4 OS are marked as non up to date in logfile.

I think you should report this as a separate issue, this is the PR for a different fix and it will get lost once the PR is merged.

ilwalti commented 7 months ago

I think you should report this as a separate issue, this is the PR for a different fix and it will get lost once the PR is merged.

Makes sense. Thanks.