tomaae / homeassistant-mikrotik_router

Mikrotik router integration for Home Assistant
Apache License 2.0
301 stars 50 forks source link

Reading SFP parameter from environment variable #94

Closed jjmuriel closed 3 years ago

jjmuriel commented 3 years ago

Hi, I'm using this script (schedule to run every 5 minutes) to storage the temperature value from SFP monitoring information. On Winbox I can get and see the value in /System/Scripts --> Environment (Name and value are OK) and the environment variable is an entity in Home Assistant, but the value is not updating. What can I do for update this value periodically?

:global monitorsfprx [/interface ethernet monitor sfp1-WAN once as-value]
:global monitorsfprx [:put ($monitorsfprx->"sfp-temperature")]

# not necessary
:set monitorsfprx [:tonum $monitorsfprx]

Note: Script is enable in the HACS integration and the update interval is set to 15 seconds.

Screen Shot 2021-02-04 at 12 23 52
tomaae commented 3 years ago

It should work fine, just make sure you have it enabled and all access rights set correctly.

jjmuriel commented 3 years ago

Hi @tomaae and thank you for your response. I double check the permissions and access, both in RouterOS's user that Home Assistant use and in the script, and everything seems correct. Like the attached image shows, the value of this variable is updating randomly and within a very long period of time. The only error that I can see in the HA Logs is this:

Logger: custom_components.mikrotik_router.mikrotikapi
Source: custom_components/mikrotik_router/mikrotikapi.py:98
Integration: Mikrotik Router (documentation)
First occurred: February 4, 2021, 8:25:32 PM (1 occurrences)
Last logged: February 4, 2021, 8:25:32 PM

Mikrotik 192.168.111.1 error while building list for path : Connection unexpectedly closed.
Screen Shot 2021-02-05 at 9 24 55 Screen Shot 2021-02-05 at 9 33 02
tomaae commented 3 years ago

this is how it would looks normally as temp usually dont change much. disable the script and try to change the value manually to test it.

no idea what that disconnect is, you would need to debug it, in case it repeats.

jjmuriel commented 3 years ago

There is no change if I manually replace the value of the variable. The only way that the value is updating, is when I reboot HA Core.

This is some extract of my log with the debug option enable:

2021-02-05 16:41:29 DEBUG (SyncWorker_4) [custom_components.mikrotik_router.mikrotikapi] Mikrotik Connected to 192.168.111.1
2021-02-05 16:41:29 DEBUG (SyncWorker_4) [custom_components.mikrotik_router.mikrotikapi] API query: /system/package/update
2021-02-05 16:41:29 DEBUG (SyncWorker_4) [custom_components.mikrotik_router.helper] Processing source [{'channel': 'stable', 'installed-version': '6.48.1', 'status': 'finding out latest version...'}]
2021-02-05 16:41:29 DEBUG (SyncWorker_4) [custom_components.mikrotik_router.helper] Processing entry {'channel': 'stable', 'installed-version': '6.48.1', 'status': 'finding out latest version...'}
2021-02-05 16:41:29 INFO (MainThread) [homeassistant.setup] Setting up notify
2021-02-05 16:41:29 INFO (MainThread) [homeassistant.setup] Setup of domain localtuya took 0.4 seconds
2021-02-05 16:41:29 INFO (MainThread) [homeassistant.setup] Setup of domain zeroconf took 0.1 seconds
2021-02-05 16:41:29 INFO (MainThread) [homeassistant.setup] Setup of domain light took 0.1 seconds
2021-02-05 16:41:29 INFO (MainThread) [homeassistant.setup] Setting up ipp
2021-02-05 16:41:29 INFO (MainThread) [homeassistant.setup] Setup of domain ipp took 0.0 seconds
2021-02-05 16:41:29 INFO (MainThread) [homeassistant.setup] Setting up shelly
2021-02-05 16:41:29 INFO (MainThread) [homeassistant.setup] Setup of domain shelly took 0.0 seconds
2021-02-05 16:41:29 DEBUG (SyncWorker_2) [custom_components.mikrotik_router.mikrotikapi] API query: /system/package
2021-02-05 16:41:29 INFO (MainThread) [homeassistant.setup] Setting up webostv
2021-02-05 16:41:29 DEBUG (SyncWorker_2) [custom_components.mikrotik_router.helper] Processing source [{'.id': '*1', 'name': 'ntp', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}, {'.id': '*2', 'name': 'ppp', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}, {'.id': '*3', 'name': 'dhcp', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}, {'.id': '*4', 'name': 'security', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}, {'.id': '*5', 'name': 'advanced-tools', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}, {'.id': '*6', 'name': 'system', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}, {'.id': '*7', 'name': 'multicast', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}, {'.id': '*8', 'name': 'routing', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}]
2021-02-05 16:41:29 DEBUG (SyncWorker_2) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*1', 'name': 'ntp', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:29 DEBUG (SyncWorker_2) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*2', 'name': 'ppp', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:29 DEBUG (SyncWorker_2) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*3', 'name': 'dhcp', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:29 DEBUG (SyncWorker_2) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*4', 'name': 'security', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:29 DEBUG (SyncWorker_2) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*5', 'name': 'advanced-tools', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:29 DEBUG (SyncWorker_2) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*6', 'name': 'system', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:29 DEBUG (SyncWorker_2) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*7', 'name': 'multicast', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:29 DEBUG (SyncWorker_2) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*8', 'name': 'routing', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}

2021-02-05 16:41:30 DEBUG (SyncWorker_7) [custom_components.mikrotik_router.mikrotikapi] API query: /system/resource
2021-02-05 16:41:30 DEBUG (SyncWorker_7) [custom_components.mikrotik_router.helper] Processing source [{'uptime': '6h49m52s', 'version': '6.48.1 (stable)', 'build-time': 'Feb/03/2021 10:54:22', 'factory-software': '6.35.3', 'free-memory': 1028440064, 'total-memory': 1073741824, 'cpu': 'ARMv7', 'cpu-count': 2, 'cpu-frequency': 1400, 'cpu-load': 1, 'free-hdd-space': 96604160, 'total-hdd-space': 134479872, 'architecture-name': 'arm', 'board-name': 'RB3011UiAS', 'platform': 'MikroTik'}]
2021-02-05 16:41:30 DEBUG (SyncWorker_7) [custom_components.mikrotik_router.helper] Processing entry {'uptime': '6h49m52s', 'version': '6.48.1 (stable)', 'build-time': 'Feb/03/2021 10:54:22', 'factory-software': '6.35.3', 'free-memory': 1028440064, 'total-memory': 1073741824, 'cpu': 'ARMv7', 'cpu-count': 2, 'cpu-frequency': 1400, 'cpu-load': 1, 'free-hdd-space': 96604160, 'total-hdd-space': 134479872, 'architecture-name': 'arm', 'board-name': 'RB3011UiAS', 'platform': 'MikroTik'}

2021-02-05 16:41:30 DEBUG (SyncWorker_8) [custom_components.mikrotik_router.helper] Processing source [{'.id': '*1', '.nextid': '*4', 'Full Script INFO

2021-02-05 16:41:30 DEBUG (SyncWorker_8) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*4', '.nextid': '*5', 'name': 'respaldo_binario', 'owner': 'admin', 'policy': 'ftp,read,write,policy,test', 'dont-require-permissions': True, 'last-started': 'feb/04/2021 11:22:09', 'run-count': 2, 'source': '/system backup save name=([/system identity get name] . "-" 
..

2021-02-05 16:41:30 DEBUG (SyncWorker_8) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*6', 'name': 'SFPTemp', 'owner': 'admin', 'policy': 'read,write,policy,test,password', 'dont-require-permissions': True, 'last-started': 'feb/05/2021 16:38:45', 'run-count': 113, 'source': ':global monitorsfp [/interface ethernet monitor sfp1-WAN once as-value]\r\n:global monitorsfp [:put ($monitorsfp->"sfp-temperature")]\r\n:set monitorsfp [:tonum $monitorsfp]', 'invalid': False, 'comment': 'Monitorea la temperatura del modulo SFP y la guarda en una variable que se lee desde Home Assistant'}

2021-02-05 16:41:30 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.helper] Processing source full dhcp config}

2021-02-05 16:41:30 DEBUG (SyncWorker_9) [custom_components.mikrotik_router.mikrotikapi] API query: /ip/dns/static
2021-02-05 16:41:30 DEBUG (SyncWorker_9) [custom_components.mikrotik_router.helper] Processing source [{'.id': '*1', 'name': 'duckdns_url.duckdns.org', 'address': '192.168.111.10', 'ttl': '1d', 'dynamic': False, 'disabled': True}]
2021-02-05 16:41:30 DEBUG (SyncWorker_9) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*1', 'name': 'duckdns_url.duckdns.org', 'address': '192.168.111.10', 'ttl': '1d', 'dynamic': False, 'disabled': True}
2021-02-05 16:41:30 INFO (SyncWorker_4) [homeassistant.loader] Loaded plex from homeassistant.components.plex
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.setup] Setup of domain notify took 0.9 seconds
2021-02-05 16:41:30 DEBUG (SyncWorker_8) [custom_components.mikrotik_router.mikrotikapi] API query: /system/package/update
2021-02-05 16:41:30 DEBUG (SyncWorker_8) [custom_components.mikrotik_router.helper] Processing source [{'channel': 'stable', 'installed-version': '6.48.1', 'status': 'finding out latest version...'}]
2021-02-05 16:41:30 DEBUG (SyncWorker_8) [custom_components.mikrotik_router.helper] Processing entry {'channel': 'stable', 'installed-version': '6.48.1', 'status': 'finding out latest version...'}
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.setup] Setting up cast
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.setup] Setup of domain cast took 0.0 seconds
2021-02-05 16:41:30 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.mikrotikapi] API query: /system/package
2021-02-05 16:41:30 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.helper] Processing source [{'.id': '*1', 'name': 'ntp', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}, {'.id': '*2', 'name': 'ppp', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}, {'.id': '*3', 'name': 'dhcp', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}, {'.id': '*4', 'name': 'security', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}, {'.id': '*5', 'name': 'advanced-tools', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}, {'.id': '*6', 'name': 'system', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}, {'.id': '*7', 'name': 'multicast', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}, {'.id': '*8', 'name': 'routing', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}]
2021-02-05 16:41:30 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*1', 'name': 'ntp', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:30 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*2', 'name': 'ppp', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:30 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*3', 'name': 'dhcp', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:30 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*4', 'name': 'security', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:30 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*5', 'name': 'advanced-tools', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:30 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*6', 'name': 'system', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:30 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*7', 'name': 'multicast', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:30 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*8', 'name': 'routing', 'version': '6.48.1', 'build-time': 'feb/03/2021 10:54:22', 'scheduled': '', 'disabled': False}
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.components.updater] Submitted analytics to Home Assistant servers. Information submitted includes {}
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.setup] Setting up mobile_app
2021-02-05 16:41:30 DEBUG (SyncWorker_8) [custom_components.mikrotik_router.mikrotikapi] API query: /system/routerboard
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.cast
2021-02-05 16:41:30 DEBUG (SyncWorker_8) [custom_components.mikrotik_router.helper] Processing source [{'routerboard': True, 'model': 'RouterBOARD 3011UiAS', 'serial-number': '', 'firmware-type': 'ipq8060', 'factory-firmware': '6.42.12', 'current-firmware': '6.48.1', 'upgrade-firmware': '6.48.1'}]
2021-02-05 16:41:30 DEBUG (SyncWorker_8) [custom_components.mikrotik_router.helper] Processing entry {'routerboard': True, 'model': 'RouterBOARD 3011UiAS', 'serial-number': '', 'firmware-type': 'ipq8060', 'factory-firmware': '6.42.12', 'current-firmware': '6.48.1', 'upgrade-firmware': '6.48.1'}
2021-02-05 16:41:30 DEBUG (SyncWorker_3) [custom_components.mikrotik_router.mikrotikapi] API query: /system/resource
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.setup] Setup of domain mobile_app took 0.0 seconds
2021-02-05 16:41:30 DEBUG (SyncWorker_3) [custom_components.mikrotik_router.helper] Processing source [{'uptime': '6h49m53s', 'version': '6.48.1 (stable)', 'build-time': 'Feb/03/2021 10:54:22', 'factory-software': '6.35.3', 'free-memory': 1028440064, 'total-memory': 1073741824, 'cpu': 'ARMv7', 'cpu-count': 2, 'cpu-frequency': 1400, 'cpu-load': 0, 'free-hdd-space': 96604160, 'total-hdd-space': 134479872, 'architecture-name': 'arm', 'board-name': 'RB3011UiAS', 'platform': 'MikroTik'}]
2021-02-05 16:41:30 DEBUG (SyncWorker_3) [custom_components.mikrotik_router.helper] Processing entry {'uptime': '6h49m53s', 'version': '6.48.1 (stable)', 'build-time': 'Feb/03/2021 10:54:22', 'factory-software': '6.35.3', 'free-memory': 1028440064, 'total-memory': 1073741824, 'cpu': 'ARMv7', 'cpu-count': 2, 'cpu-frequency': 1400, 'cpu-load': 0, 'free-hdd-space': 96604160, 'total-hdd-space': 134479872, 'architecture-name': 'arm', 'board-name': 'RB3011UiAS', 'platform': 'MikroTik'}
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.setup] Setting up device_tracker
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.components.notify] Setting up notify.mobile_app
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.mobile_app
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.mobile_app
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.mobile_app
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.mobile_app
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.mobile_app
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.mobile_app
2021-02-05 16:41:30 DEBUG (SyncWorker_9) [custom_components.mikrotik_router.mikrotikapi] API query: /system/script

2021-02-05 16:41:30 INFO (MainThread) [homeassistant.setup] Setting up default_config
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.setup] Setup of domain device_tracker took 0.0 seconds
2021-02-05 16:41:30 INFO (SyncWorker_0) [homeassistant.loader] Loaded stream from homeassistant.components.stream
2021-02-05 16:41:30 DEBUG (SyncWorker_4) [custom_components.mikrotik_router.mikrotikapi] API query: /ip/dhcp-server/network

2021-02-05 16:41:30 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.mobile_app
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.mobile_app
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.mobile_app
2021-02-05 16:41:30 DEBUG (SyncWorker_9) [custom_components.mikrotik_router.mikrotikapi] API query: /ip/dns/static
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.setup] Setting up stream
2021-02-05 16:41:30 DEBUG (SyncWorker_9) [custom_components.mikrotik_router.helper] Processing source [{'.id': '*1', 'name': 'duckdns_url.duckdns.org', 'address': '192.168.111.10', 'ttl': '1d', 'dynamic': False, 'disabled': True}]
2021-02-05 16:41:30 DEBUG (SyncWorker_9) [custom_components.mikrotik_router.helper] Processing entry {'.id': '*1', 'name': 'duckdns_url.duckdns.org', 'address': '192.168.111.10', 'ttl': '1d', 'dynamic': False, 'disabled': True}
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.setup] Setup of domain stream took 0.0 seconds
2021-02-05 16:41:30 INFO (MainThread) [homeassistant.setup] Setup of domain default_config took 0.0 seconds
2021-02-05 16:41:30 DEBUG (SyncWorker_4) [custom_components.mikrotik_router.mikrotikapi] API query: /interface
2021-02-05 16:41:30 DEBUG (SyncWorker_4) [custom_components.mikrotik_router.helper] Processing source [{'.id': '*1', 'name': 'ether1', 'default-name': 'ether1', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '', 'last-link-up-time': 'feb/05/2021 09:51:52', 'link-downs': 0, 'rx-byte': 305351137, 'tx-byte': 1717077596, 'rx-packet': 1077137, 'tx-packet': 2834034, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 123, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 263749767, 'fp-tx-byte': 1654929068, 'fp-rx-packet': 810049, 'fp-tx-packet': 2346386, 'running': True, 'slave': True, 'disabled': False, 'comment': 'Orbi router RBR20'}, {'.id': '*2', 'name': 'ether2', 'default-name': 'ether2', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '', 'last-link-down-time': 'feb/05/2021 09:52:14', 'last-link-up-time': 'feb/05/2021 09:52:24', 'link-downs': 2, 'rx-byte': 446861926, 'tx-byte': 2557712389, 'rx-packet': 1248660, 'tx-packet': 2723464, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 560, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 411662311, 'fp-tx-byte': 2435443749, 'fp-rx-packet': 937501, 'fp-tx-packet': 2287642, 'running': True, 'slave': True, 'disabled': False, 'comment': 'Orbi RBS20 SAT Sala de TV'}, {'.id': '*3', 'name': 'ether3', 'default-name': 'ether3', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '', 'last-link-up-time': 'feb/05/2021 09:51:52', 'link-downs': 0, 'rx-byte': 115465572, 'tx-byte': 151582919, 'rx-packet': 292967, 'tx-packet': 543036, 'rx-drop': 0, 'tx-drop': 0, 'tx-queue-drop': 0, 'rx-error': 0, 'tx-error': 0, 'fp-rx-byte': 21499186, 'fp-tx-byte': 77162064, 'fp-rx-packet': 86504, 'fp-tx-packet': 97409, 'running': True, 'slave': True, 'disabled': False, 'comment': 'Proxmox- HA Server'}, {'.id': '*4', 'name': 'ether4', 'default-name': 'ether4', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '', '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': '*5', 'name': 'ether5', 'default-name': 'ether5', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '', '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': '*7', 'name': 'ether6', 'default-name': 'ether6', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '', '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, 'comment': 'Deco Sala de TV (vel. fija a 100Mbps)'}, {'.id': '*8', 'name': 'ether7', 'default-name': 'ether7', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '', '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, 'comment': 'Deco Salacomedor (vel. fija a 100Mbps)'}, {'.id': '*9', 'name': 'ether8', 'default-name': 'ether8', 'type': 'ether', 'mtu': 1500, 'actual-mtu': 1500, 'l2mtu': 1598, 'max-l2mtu': 8156, 'mac-address': '', 
tomaae commented 3 years ago

thats very small part of a cycle, I need at least full cycle, so let it run for longer then your refresh period is for this integration.

btw, I may add native support for SFP. I just got my first SFP few days ago, so I will be looking into what kind of information can mikrotik give us regarding connected SFP. Its just metalic, but hopefully they provide same kind information. I dont have my development environment fully set up right now, so cant check this at the moment.

jjmuriel commented 3 years ago

Thank you @tomaae . The problem with the debug log is that shows sensitive information like MAC Addresses, passwords, etc. I can get my full script configuration in the log. I will try with another Mikrotik Router without my full configuration. Btw, great news! the SFP information support.

tomaae commented 3 years ago

oh yea, it does. you can mask them, thats no prob

tomaae commented 3 years ago

Environment variable refresh is fixed.

jjmuriel commented 3 years ago

Thank you. @tomaae!

jjmuriel commented 3 years ago

Now the environment variable is refreshing fine, Thank you again @tomaae.

tomaae commented 3 years ago

image Everything is there now. I cannot read some variables as temperature, but I assume its not available on all SFP. I only have copper one.

jjmuriel commented 3 years ago

Hi, Great Job @tomaae! I can confirm that the information will depend on the SFP module you have installed. I have a GPON SFP Zisa OP151S module (see the attached data sheet) and an RJ-45 S-RJ01 module (https://mikrotik.com/product/S-RJ01). The information on the Zisa module is much more detailed and has other parameters such as temperature (see the attached pictures). I'm going to test the changes in your new integration, but if you need that I test something specific, please let me know.

SFP-GPON Siza OP151S SFP-S-RJ01

ZISA OP151S.pdf ZISA OP151s User Manual.pdf

tomaae commented 3 years ago

I have S-RJ01 as well. But I added everything based on Mikrotik documentation, so everything should be there. We will see what kind of info GPON SFP Zisa OP151S module shows.

jjmuriel commented 3 years ago

The information seems ok. How do you think?

image

tomaae commented 3 years ago

yea, looks good. thanks for checking :)

jjmuriel commented 3 years ago

Thanks to you.