homeassistant-mikrotik_router icon indicating copy to clipboard operation
homeassistant-mikrotik_router copied to clipboard

[Bug] HA entities do not update faster than 30 seconds

Open PiotrWawryniuk opened this issue 2 years ago • 4 comments

I am not sure if that is a bug or just kind of misconfiguration. I did not find any solution for it, so as discussed previously: It seems that integration itself queries device (RB3011 in my case) but is not equally reflected state to HA.

Details: Having configured the integration and using Scan Interval lower than 30secs have no influence on the values being reported on dashboards / devices. It is always 30secs or more. When I am analysing debug logs it seems that my router is queried every e.g. 5 secs. But looking at the e.g. Rx or Tx of particular port I am getting updates every 30secs.

Thanks in advance for any help. X.

EDIT: I am still learning the architecture of HomeAutomation and maybe I am wrong but it seems to me that we are facing such scenario:

  • Integration itself has timer#1 that follows configuration and can query physical device ever n-secs
  • Integration is queried every Scan_interval of the HomeAutomation that uses its own vauel globally set - As I found it is by default 30secs.

PiotrWawryniuk avatar Feb 15 '23 16:02 PiotrWawryniuk

I would like to see more frequent update intervals also.

amamoh avatar Feb 17 '23 08:02 amamoh

Check in queries if numbers for sensors are changing while not being reflected in HA. If they are not, HA will act as if it was not updated (in regards to last update time visible on sensor).

tomaae avatar Feb 18 '23 23:02 tomaae

@tomaae - Please correct me if I am wrong - but running the query does it reflect to specific page in Mikrotik Console? I mean: image

Would you please be so kind and check in your environment if you will be able to read Rx/Tx (of any other stats like packets etc) more frequent than 30secs?

Using your suggestion: Looking at the numbers it seems that they are "randomly" changing. Mikrotik interface is updating itself with 1s rate. Values almost always are different. Below one of the values that HAS to be changed. image

And as a sample I am pasting two different debug lines: 2023-02-19 16:27:07.479 DEBUG (SyncWorker_4) [custom_components.mikrotik_router.apiparser] Processing source [{'.id': '*1', 'name': 'WAN1', 'default-name': 'ether1', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-down-time': 'feb/18/2023 20:07:26', 'last-link-up-time': 'feb/18/2023 20:07:33', 'link-downs': 89, 'rx-byte': 144788431336, 'tx-byte': 11761388811, 'rx-packet': 332414256, 'tx-packet': 38597035, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 8353, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 143275164843, 'fp-tx-byte': 11608007552, 'fp-rx-packet': 331999885, 'fp-tx-packet': 38603907, 'running': True, 'disabled': False}, {'.id': '*6', 'name': 'WAN2', 'default-name': 'sfp1', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1600, 'max-l2mtu': 8158, 'mac-address': '**REDACTED**', 'last-link-down-time': 'feb/16/2023 14:55:46', 'last-link-up-time': 'feb/16/2023 12:58:26', 'link-downs': 3, 'rx-byte': 1045033463, 'tx-byte': 311683843, 'rx-packet': 1290712, 'tx-packet': 973733, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 14, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 1045033463, 'fp-tx-byte': 311683843, 'fp-rx-packet': 1290712, 'fp-tx-packet': 973733, 'running': False, 'disabled': False}, {'.id': '*2', 'name': 'ether2', 'default-name': 'ether2', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:29', 'link-downs': 0, 'rx-byte': 7673055862, 'tx-byte': 47768622859, 'rx-packet': 20261963, 'tx-packet': 49665726, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 10904, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 6864545778, 'fp-tx-byte': 39905869987, 'fp-rx-packet': 15195518, 'fp-tx-packet': 39693817, 'running': True, 'slave': True, 'disabled': False}, {'.id': '*3', 'name': 'ether3', 'default-name': 'ether3', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'link-downs': 0, 'rx-byte': 0, 'tx-byte': 0, 'rx-packet': 0, 'tx-packet': 0, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 0, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 0, 'fp-tx-byte': 0, 'fp-rx-packet': 0, 'fp-tx-packet': 0, 'running': False, 'slave': True, 'disabled': False}, {'.id': '*4', 'name': 'ether4', 'default-name': 'ether4', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:28', 'link-downs': 0, 'rx-byte': 41851794154, 'tx-byte': 12489117754, 'rx-packet': 43375992, 'tx-packet': 25436123, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 295, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 4213933599, 'fp-tx-byte': 8143590202, 'fp-rx-packet': 12011060, 'fp-tx-packet': 12254314, 'running': True, 'slave': True, 'disabled': False}, {'.id': '*5', 'name': 'ether5', 'default-name': 'ether5', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:28', 'link-downs': 0, 'rx-byte': 5664058514, 'tx-byte': 93296866779, 'rx-packet': 25165097, 'tx-packet': 71710457, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 18692, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 1703879011, 'fp-tx-byte': 61426247105, 'fp-rx-packet': 17604676, 'fp-tx-packet': 46185914, 'running': True, 'slave': True, 'disabled': False}, {'.id': '*7', 'name': 'ether6', 'default-name': 'ether6', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:27', 'link-downs': 0, 'rx-byte': 18992942, 'tx-byte': 1043373843, 'rx-packet': 139923, 'tx-packet': 3868137, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 0, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 18432550, 'fp-tx-byte': 279110509, 'fp-rx-packet': 139921, 'fp-tx-packet': 1512641, 'running': True, 'slave': True, 'disabled': False}, {'.id': '*8', 'name': 'ether7', 'default-name': 'ether7', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'link-downs': 0, 'rx-byte': 0, 'tx-byte': 0, 'rx-packet': 0, 'tx-packet': 0, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 0, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 0, 'fp-tx-byte': 0, 'fp-rx-packet': 0, 'fp-tx-packet': 0, 'running': False, 'slave': True, 'disabled': False}, {'.id': '*9', 'name': 'ether8', 'default-name': 'ether8', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:28', 'link-downs': 0, 'rx-byte': 5122743, 'tx-byte': 1003092733, 'rx-packet': 51802, 'tx-packet': 3758525, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 0, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 4915185, 'fp-tx-byte': 239372771, 'fp-rx-packet': 51801, 'fp-tx-packet': 1402933, 'running': True, 'slave': True, 'disabled': False}, {'.id': '*A', 'name': 'ether9', 'default-name': 'ether9', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:28', 'link-downs': 0, 'rx-byte': 542862366, 'tx-byte': 758076352, 'rx-packet': 1070197, 'tx-packet': 3554609, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 0, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 538578164, 'fp-tx-byte': 357770746, 'fp-rx-packet': 1070190, 'fp-tx-packet': 1869110, 'running': True, 'slave': True, 'disabled': False}, {'.id': '*B', 'name': 'ether10', 'default-name': 'ether10', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:28', 'link-downs': 0, 'rx-byte': 898341466, 'tx-byte': 7155071446, 'rx-packet': 2376087, 'tx-packet': 9020957, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 11797, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 885638390, 'fp-tx-byte': 6755560178, 'fp-rx-packet': 2373879, 'fp-tx-packet': 8350750, 'running': True, 'slave': True, 'disabled': False}, {'.id': '*C', 'name': 'bridge', 'type': 'bridge', 'mtu': 'auto', 'actual-mtu': 1500, 'l2mtu': 1598, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:25', 'link-downs': 0, 'rx-byte': 12878263857, 'tx-byte': 113542727051, 'rx-packet': 45703789, 'tx-packet': 97854797, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 0, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 12351780950, 'fp-tx-byte': 105704021461, 'fp-rx-packet': 43953222, 'fp-tx-packet': 84252143, 'running': True, 'disabled': False, 'comment': 'defconf'}] 2023-02-19 16:27:14.189 DEBUG (SyncWorker_5) [custom_components.mikrotik_router.apiparser] Processing source [{'.id': '*1', 'name': 'WAN1', 'default-name': 'ether1', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-down-time': 'feb/18/2023 20:07:26', 'last-link-up-time': 'feb/18/2023 20:07:33', 'link-downs': 89, 'rx-byte': 144789516559, 'tx-byte': 11761481737, 'rx-packet': 332418931, 'tx-packet': 38597658, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 8353, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 143276287882, 'fp-tx-byte': 11608101180, 'fp-rx-packet': 332004703, 'fp-tx-packet': 38604548, 'running': True, 'disabled': False}, {'.id': '*6', 'name': 'WAN2', 'default-name': 'sfp1', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1600, 'max-l2mtu': 8158, 'mac-address': '**REDACTED**', 'last-link-down-time': 'feb/16/2023 14:55:46', 'last-link-up-time': 'feb/16/2023 12:58:26', 'link-downs': 3, 'rx-byte': 1045033463, 'tx-byte': 311683843, 'rx-packet': 1290712, 'tx-packet': 973733, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 14, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 1045033463, 'fp-tx-byte': 311683843, 'fp-rx-packet': 1290712, 'fp-tx-packet': 973733, 'running': False, 'disabled': False}, {'.id': '*2', 'name': 'ether2', 'default-name': 'ether2', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:29', 'link-downs': 0, 'rx-byte': 7673095061, 'tx-byte': 47769088939, 'rx-packet': 20262301, 'tx-packet': 49666435, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 10904, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 6864558745, 'fp-tx-byte': 39905963661, 'fp-rx-packet': 15195579, 'fp-tx-packet': 39693950, 'running': True, 'slave': True, 'disabled': False}, {'.id': '*3', 'name': 'ether3', 'default-name': 'ether3', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'link-downs': 0, 'rx-byte': 0, 'tx-byte': 0, 'rx-packet': 0, 'tx-packet': 0, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 0, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 0, 'fp-tx-byte': 0, 'fp-rx-packet': 0, 'fp-tx-packet': 0, 'running': False, 'slave': True, 'disabled': False}, {'.id': '*4', 'name': 'ether4', 'default-name': 'ether4', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:28', 'link-downs': 0, 'rx-byte': 41852277801, 'tx-byte': 12489723067, 'rx-packet': 43377404, 'tx-packet': 25437395, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 295, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 4214041909, 'fp-tx-byte': 8144160840, 'fp-rx-packet': 12011870, 'fp-tx-packet': 12255262, 'running': True, 'slave': True, 'disabled': False}, {'.id': '*5', 'name': 'ether5', 'default-name': 'ether5', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:28', 'link-downs': 0, 'rx-byte': 5664113740, 'tx-byte': 93297014306, 'rx-packet': 25165305, 'tx-packet': 71710743, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 18692, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 1703888807, 'fp-tx-byte': 61426371399, 'fp-rx-packet': 17604792, 'fp-tx-packet': 46186083, 'running': True, 'slave': True, 'disabled': False}, {'.id': '*7', 'name': 'ether6', 'default-name': 'ether6', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:27', 'link-downs': 0, 'rx-byte': 18993010, 'tx-byte': 1043390604, 'rx-packet': 139924, 'tx-packet': 3868190, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 0, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 18432614, 'fp-tx-byte': 279113605, 'fp-rx-packet': 139922, 'fp-tx-packet': 1512660, 'running': True, 'slave': True, 'disabled': False}, {'.id': '*8', 'name': 'ether7', 'default-name': 'ether7', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'link-downs': 0, 'rx-byte': 0, 'tx-byte': 0, 'rx-packet': 0, 'tx-packet': 0, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 0, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 0, 'fp-tx-byte': 0, 'fp-rx-packet': 0, 'fp-tx-packet': 0, 'running': False, 'slave': True, 'disabled': False}, {'.id': '*9', 'name': 'ether8', 'default-name': 'ether8', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:28', 'link-downs': 0, 'rx-byte': 5122743, 'tx-byte': 1003109430, 'rx-packet': 51802, 'tx-packet': 3758577, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 0, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 4915185, 'fp-tx-byte': 239375825, 'fp-rx-packet': 51801, 'fp-tx-packet': 1402951, 'running': True, 'slave': True, 'disabled': False}, {'.id': '*A', 'name': 'ether9', 'default-name': 'ether9', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:28', 'link-downs': 0, 'rx-byte': 542871005, 'tx-byte': 758091437, 'rx-packet': 1070219, 'tx-packet': 3554666, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 0, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 538586715, 'fp-tx-byte': 357777100, 'fp-rx-packet': 1070212, 'fp-tx-packet': 1869142, 'running': True, 'slave': True, 'disabled': False}, {'.id': '*B', 'name': 'ether10', 'default-name': 'ether10', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:28', 'link-downs': 0, 'rx-byte': 898345488, 'tx-byte': 7155086609, 'rx-packet': 2376100, 'tx-packet': 9021012, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 11797, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 885642300, 'fp-tx-byte': 6755570129, 'fp-rx-packet': 2373891, 'fp-tx-packet': 8350795, 'running': True, 'slave': True, 'disabled': False}, {'.id': '*C', 'name': 'bridge', 'type': 'bridge', 'mtu': 'auto', 'actual-mtu': 1500, 'l2mtu': 1598, 'mac-address': '**REDACTED**', 'last-link-up-time': 'feb/13/2023 11:15:25', 'link-downs': 0, 'rx-byte': 12878399101, 'tx-byte': 113543496441, 'rx-packet': 45704778, 'tx-packet': 97855984, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 0, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 12351905531, 'fp-tx-byte': 105704614404, 'fp-rx-packet': 43954184, 'fp-tx-packet': 84252741, 'running': True, 'disabled': False, 'comment': 'defconf'}]

They are different.

PiotrWawryniuk avatar Feb 19 '23 15:02 PiotrWawryniuk

No, query does not have to reflect a page, but it can in many cases. I will check if I can replicate this.

tomaae avatar Feb 19 '23 16:02 tomaae