tomaae / homeassistant-mikrotik_router

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

[Bug] RouterOS version becomes Unknown #342

Closed ilwalti closed 7 months ago

ilwalti commented 7 months ago

Describe the issue

RouterOS version becomes Unknown

How to reproduce the issue

Looking at the "settings" tab

Expected behavior

In the past, once verified the version remains the same

Screenshots

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

Any ideas?

Software versions

Diagnostics data

2024-02-14 14:06:17.948 DEBUG (SyncWorker_61) [custom_components.mikrotik_router.mikrotikapi] API query: /system/resource 2024-02-14 14:06:17.952 DEBUG (SyncWorker_61) [custom_components.mikrotik_router.apiparser] Processing source [{'uptime': '6d4h40m57s', 'version': '7.13.4 (stable)', 'build-time': 'Feb/07/2024 09:59:26', 'factory-software': '7.10', 'free-memory': 406016000, 'total-memory': 469762048, 'cpu': 'ARM', 'cpu-count': 2, 'cpu-frequency': 800, 'cpu-load': 0, 'free-hdd-space': 107638784, 'total-hdd-space': 134217728, 'write-sect-since-reboot': 33204, 'write-sect-total': 710022, 'bad-blocks': 0, 'architecture-name': 'arm', 'board-name': 'L009UiGS', 'platform': 'MikroTik'}] 2024-02-14 14:06:17.953 DEBUG (SyncWorker_61) [custom_components.mikrotik_router.apiparser] Processing entry {'uptime': '6d4h40m57s', 'version': '7.13.4 (stable)', 'build-time': 'Feb/07/2024 09:59:26', 'factory-software': '7.10', 'free-memory': 406016000, 'total-memory': 469762048, 'cpu': 'ARM', 'cpu-count': 2, 'cpu-frequency': 800, 'cpu-load': 0, 'free-hdd-space': 107638784, 'total-hdd-space': 134217728, 'write-sect-since-reboot': 33204, 'write-sect-total': 710022, 'bad-blocks': 0, 'architecture-name': 'arm', 'board-name': 'L009UiGS', 'platform': 'MikroTik'} 2024-02-14 14:06:17.953 DEBUG (SyncWorker_61) [custom_components.mikrotik_router.mikrotikapi] API query: /system/package/update 2024-02-14 14:06:22.961 DEBUG (SyncWorker_61) [custom_components.mikrotik_router.mikrotikapi] API query: /system/package/update 2024-02-14 14:06:22.964 DEBUG (SyncWorker_61) [custom_components.mikrotik_router.apiparser] Processing source [{'channel': 'stable', 'installed-version': '7.13.4', 'status': 'ERROR: connection timed out'}] 2024-02-14 14:06:22.964 DEBUG (SyncWorker_61) [custom_components.mikrotik_router.apiparser] Processing entry {'channel': 'stable', 'installed-version': '7.13.4', 'status': 'ERROR: connection timed out'} 2024-02-14 14:06:22.964 DEBUG (SyncWorker_61) [custom_components.mikrotik_router.coordinator] Mikrotik 10.7.1.1 FW version major=7 minor=13 (7.13.4)

Traceback/Error logs

Additional context

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)

tomaae commented 7 months ago

that is not a problem with integration, but your router timing out on version check.

ilwalti commented 7 months ago

Hi, thanks for your answer. Not sure that is only a problem of mine... In coordinator.py I've found this code:

 self.execute(   
            "/system/package/update", "check-for-updates", None, None, {"duration": 10}
        ) 

I suppose that this is the command used to check the version, right? If I execute this on my routers with duration=10 I don't get any timeout... I've to lower duration to 1 to get a bad response. Am I totally wrong? Thanks!

tomaae commented 7 months ago

Yes, its correct code. Are you sure there are no other errors in HA log? With 7.13 it should crash on wifi query unless you are using latest master.

ilwalti commented 7 months ago

Yes, I do use the latest master, that is the only one working with 7.13.. anyway, I've changed the "duration" parameter to 30 (seconds, I suppose) and got no error messages in the last 12 hours.

tomaae commented 7 months ago

that means your router takes more then 10 seconds to respond. thats really bad. While you can use such workaround for integration, there is much larger issue you have with your mikrotik/network. I will be closing this as it is not related to integration.