Home Assistant Community

FortiOS device_tracker


So it works until 5.6 at least.
I’ll try to run it against 6.0 sometime…


upgraded to 88.2
Seems like the FortiOS device tracker doesn’t work anymore.
Logs told me to change directories, so now I have custom_components/fortiOS/device_trackery.py

Now in logs I get this error.

Log Details (ERROR)
Sun Mar 03 2019 19:11:55 GMT-0600 (CST)

Error setting up platform fortiOS
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/device_tracker/__init__.py", line 177, in async_setup_platform
    platform.get_scanner, hass, {DOMAIN: p_config})
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/fortiOS/device_tracker.py", line 32, in get_scanner
    scanner = FortiDeviceScanner(config[DOMAIN])
  File "/config/custom_components/fortiOS/device_tracker.py", line 50, in __init__
    self.success_init = self._update_info()
  File "/config/custom_components/fortiOS/device_tracker.py", line 70, in _update_info
    string_result = self._get_arp_data()
  File "/config/custom_components/fortiOS/device_tracker.py", line 104, in _get_arp_data
    from pexpect import pxssh
  File "/config/deps/lib/python3.7/site-packages/pexpect/__init__.py", line 75, in <module>
    from .pty_spawn import spawn, spawnu
  File "/config/deps/lib/python3.7/site-packages/pexpect/pty_spawn.py", line 15, in <module>
    from .spawnbase import SpawnBase
  File "/config/deps/lib/python3.7/site-packages/pexpect/spawnbase.py", line 218
    def expect(self, pattern, timeout=-1, searchwindowsize=-1, async=False):
SyntaxError: invalid syntax



Any ideas? If not, I guess I will try another tracking system.


I didn’t have the time to look at the upgrade, but I saw that 88 was likely to break a lot of things. This component (which I rely on exclusively for device tracking), my central heater component too. So I decided to wait a bit before upgrading.

You have handled the first modification needed, move the custom component to the right directory. Have you created an empty __init__.py there ?

Next step will be to understand what has changed in the registration of the tracker. I’ll try to look at it (so break my system and upgrade !) next week. I run on VMWare so I can do a snapshot and restore if things go really bad !



I ended up forgoing Fortinet tracking and used the unifi tracking. Everyone I want to track is on wifi, and I host my unifi controller on a VM via Google Engine. But I can certainly help you troubleshoot if you want. I did not create an empty init.py. Let me know if I can help. I am sure there are not too many home users with a Fortigate as a firewall. :slight_smile:


I’ve updated and tried… Move to 0.92 and everything went wrong.
Reverted to 0.91.4 and Fortios tracker seems to work. I didn’t do much :

  • move <custom>/device_tracker/fortios.py to <custom>/fortios/device_tracker.py
  • create an empty <custom>/fortios/__init.py__
  • don’t forget to ensure the full path has correct permissions for homeassistant user

At first nothing happened, but maybe 30 seconds later, the trackers were ok.

I have lots of problems though with other components, I’m not sure I won’t rollback (I’ve taken a VM snapshot to be safe !)


A few weeks later, I’m running 0.92.2 and everything is fine.
For this specific component :

  • create a __init__.py file with the domain information :
    DOMAIN= "FortiOS"
  • create a manifest.json (must be new with 0.92 from what I understand) :
  "domain": "FortiOS",
  "name": "FortiOS device tracker",
  "documentation": "https://www.home-assistant.io",
  "dependencies": [],
  "codeowners": [],
  "requirements": []

And that’s it.

Aside from HA compatibility, I could also test Forti Firmware compatibility. I’ve found every firmware compatible as of now :

  • 5.2 series, which are the latest for C generation. I wouldn’t recommend an early build though, they are not stable at all (DHCP mostly). 5.2.11 has proven reliable on a 111C. Move upwards without regrets with D series that support most recent releases.
  • 5.4 : only tested 5.4.6 as part of an upgrade path, it’s working too.
  • 5.6.4 is working great and also compatible. I guess this is the minimum version to use with devices with integrated wifi and/or FortiExtender.
  • 6.0.4 is fine too.
  • 6.2.0 works fine, is the latest and very fast. I’m running this one on my 100D and it’s the best firmware I’ve seen for years. (and it’s a .0 !)

Basically, it should work with any firmware that has the “get system arp” command.