Mikrotik in Device trackers can't setup

Hello All,

i got mikrotik router and now running HASSbian on RPI3, If I want to enable miktorik component in HASS (like this: https://home-assistant.io/components/device_tracker.mikrotik/) my RPI3 can’t start this service, because missing some libraries…!!!

anyone else got same problem? what is right setup to use mikrotik as device tracker? I’d like to achieve that I can use output from mikrotik about connected clients to my local wifi network to use presense detection. got different androis, ios and Windows Mobile devices…
thank you
grz

Hi, I have the same problem…have you solved it?

here´s how i fixed it…

$ sudo systemctl stop [email protected]
$ sudo su -s /bin/bash homeassistant
$ source /srv/homeassistant/bin/activate
$ pip install setuptools --upgrade
$ pip install librouteros
$ exit
$ sudo systemctl start [email protected]

cheers,
DD

Hello,
still not working. I get this error in log file:

> 2017-06-20 21:19:48 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform mikrotik
> Traceback (most recent call last):
>   File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/device_tracker/__init__.py", line 151, in async_setup_platform
>     platform.get_scanner, hass, {DOMAIN: p_config})
>   File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
>     yield self  # This tells Task to wait for completion.
>   File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
>     value = future.result()
>   File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
>     raise self._exception
>   File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
>     result = self.fn(*self.args, **self.kwargs)
>   File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/device_tracker/mikrotik.py", line 41, in get_scanner
>     scanner = MikrotikScanner(config[DOMAIN])
>   File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/device_tracker/mikrotik.py", line 71, in __init__
>     self._update_info()
>   File "/usr/local/lib/python3.4/dist-packages/homeassistant/util/__init__.py", line 303, in wrapper
>     result = method(*args, **kwargs)
>   File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/device_tracker/mikrotik.py", line 142, in _update_info
>     cmd='/interface/wireless/registration-table/getall'
>   File "/usr/local/lib/python3.4/dist-packages/librouteros/api.py", line 80, in __call__
>     return self._readResponse()
>   File "/usr/local/lib/python3.4/dist-packages/librouteros/api.py", line 103, in _readResponse
>     reply_word, words = self._readSentence()
>   File "/usr/local/lib/python3.4/dist-packages/librouteros/api.py", line 89, in _readSentence
>     words = dict(self.parseWord(word) for word in words)
>   File "/usr/local/lib/python3.4/dist-packages/librouteros/api.py", line 89, in <genexpr>
>     words = dict(self.parseWord(word) for word in words)
>   File "/usr/local/lib/python3.4/dist-packages/librouteros/api.py", line 34, in parseWord
>     _, key, value = word.split('=', 2)
> ValueError: need more than 1 value to unpack

Hi grz007,
which firmware version are you using?

try the following commands, and see if you get an output: (these are the commands the ha mikrotik plugin is using)

/system routerboard print
/interface wireless print
/ip dhcp-server lease print

hope that helps…

by the way i have tested mine with firmware 3.33 (two mikrotik devices).

Hello,
my mikrotik gives me this:
model: RouterBOARD 962UiGS-5HacT2
factory-firmware: 3.31
current-firmware: 3.31
upgrade-firmware: 3.34

grz

Hi grz,
did my commands give you an “normal” output…

“/system routerboard print
/interface wireless print
/ip dhcp-server lease print”

or do you have some special characters inside… (I had the Problem, that i was using “Umlaute: ÜÖÄ”) after getting rid of them… everything worked liked expected.

greetings
DD

1 Like

Hi,

I’ve been running for Wi-Fi presence my Mikrotik RB715G-2HnD long time trough SNMP and it works so good that I don’t even want to try this component. See if this works for you:

device_tracker:
  platform: snmp
  host: IP_ADDRESS_OF_THE_MIKROTIK
  community: SNMP_COMMUNITY_STRING
  baseoid: 1.3.6.1.4.1.14988.1.1.1.2.1.1
  track_new_devices: false
  interval_seconds: 30
  home_interval: 5
  consider_home: 180

gocenik - super, cool, its working like charm! thank you…