Mikrotik router integration for Home Assistant
Find a file
2020-04-07 10:54:19 +02:00
.github/ISSUE_TEMPLATE clearer description for integration version in bug template 2019-12-21 08:01:40 +01:00
custom_components/mikrotik_router Merge branch 'master' into pr/1 2020-04-07 10:54:19 +02:00
docs/assets/images/ui Merge branch 'master' into pr/1 2020-04-07 10:54:19 +02:00
.gitattributes initial commit 2019-12-02 01:13:28 +01:00
.sonarcloud.properties updated sonar settings 2019-12-13 10:10:38 +01:00
hacs.json updated hacs.json 2019-12-04 16:12:48 +01:00
LICENSE Create LICENSE 2019-12-02 01:24:37 +01:00
README.md Merge branch 'master' into pr/1 2020-04-07 10:54:19 +02:00
setup.cfg change lib exclude for flake8 2019-12-08 18:13:46 +01:00

Mikrotik Router

GitHub release (latest by date) hacs_badge Project Stage

GitHub commits since latest release GitHub commit activity

Tracker and sensors

Monitor and control your Mikrotik device from Home Assistant.

Features:

  • Interfaces:
    • Enable/disable interfaces
    • Monitor RX/TX traffic per interface
    • Monitor device presence per interface
    • IP, MAC, Link information per interface for connected devices
  • Enable/disable NAT rule switches
  • Enable/disable Simple Queue switches
  • Device tracker for hosts in network
  • System sensors (CPU, Memory, HDD)
  • Check firmware update
  • Execute scripts
  • Configurable update interval
  • Configurable traffic unit (bps, Kbps, Mbps, B/s, KB/s, MB/s)
  • Supports monitoring of multiple mikrotik devices simultaneously
  • RX/TX WAN/LAN traffic sensors per hosts from Mikrotik Accounting feature

Integration preview

Tracker and sensors

Interface Info Interface Switch

Interface Sensor Script Switch

NAT switch Queue switch

Host tracker Accounting sensor

Setup integration

Setup this integration for your Mikrotik device in Home Assistant via Configuration -> Integrations -> Add -> Mikrotik Router. You can add this integration several times for different devices.

Add Integration

  • "Host" - Use hostname or IP
  • "Port" - Leave at 0 for defaults
  • "Name of the integration" - Friendy name for this router
  • "Unit of measurement" - Traffic sensor measurement (bps, Kbps, Mbps, B/s, KB/s, MB/s)
  • "Track accounting" - Determines if integration will track per-host throughput. Accounting must be enabled in Mikrotik first

Configuration

Integration options

  • "Show client MAC and IP" - Display connected IP and MAC address for devices connected to ports on router.
  • "Scan interval" - Scan/refresh time in seconds. HA needs to be reloaded for scan interval change to be applied.
  • "Unit of measurement" - Traffic sensor measurement (bps, Kbps, Mbps, B/s, KB/s, MB/s)

List of detected devices

Integration options

Accounting

For per-IP throughput tracking Mikrotik's accounting feature is used.

Mikrotik support page

Before setting up integration in HA, go in Winbox IP-Accounting and setup the feature. Make sure that threshold is set to resonable value to store all connections between user defined scan interval. Max value is 8192 so for piece of mind i recommend setting that value. Web Access is not needed, integration is using API access.

Integration will scan DHCP Lease table and ARP table to generate all known hosts and create two sensors for WAN traffic (mikrotik-XXX-wan-rx and mikrotik-XXX-wan-tx). If the parameter account-local-traffic is set in Mikrotik's accounting configuration it will also create two sensors for LAN traffic (mikrotik-XXX-lan-rx and mikrotik-XXX-lan-tx).

Device's name will be determined by first available string this order:

  1. DHCP lease comment
  2. DNS static entry
  3. DHCP hostname
  4. Device's IP address