diff --git a/README.md b/README.md index a2ccf8c..af9edfc 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Features: * System sensors (CPU, Memory, HDD) * Firmware update binary sensor * Switches to run scripts - * RX/TX traffic sensors per hosts from Mikrotik Accounting + * RX/TX WAN/LAN traffic sensors per hosts from Mikrotik Accounting feature # Integration preview ![Tracker and sensors](https://raw.githubusercontent.com/tomaae/homeassistant-mikrotik_router/master/docs/assets/images/ui/device_tracker.png) @@ -32,6 +32,8 @@ Features: ![NAT switch](https://raw.githubusercontent.com/tomaae/homeassistant-mikrotik_router/master/docs/assets/images/ui/nat.png) ![Queue switch](https://raw.githubusercontent.com/tomaae/homeassistant-mikrotik_router/master/docs/assets/images/ui/queue_switch.png) +![Accounting sensor](https://raw.githubusercontent.com/tomaae/homeassistant-mikrotik_router/master/docs/assets/images/ui/accounting_sensor.png) + # 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. @@ -50,3 +52,12 @@ You can add this integration several times for different devices. ## List of detected devices ![Integration options](https://raw.githubusercontent.com/tomaae/homeassistant-mikrotik_router/master/docs/assets/images/ui/integration_devices.png) + +## Accounting +For per-IP throughput tracking Mikrotik's accounting feature is used. + +[Mikrotik support page](https://wiki.mikrotik.com/wiki/Manual:IP/Accounting) + +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). \ No newline at end of file diff --git a/custom_components/mikrotik_router/mikrotikapi.py b/custom_components/mikrotik_router/mikrotikapi.py index dd69141..bcf1c83 100644 --- a/custom_components/mikrotik_router/mikrotikapi.py +++ b/custom_components/mikrotik_router/mikrotikapi.py @@ -514,7 +514,7 @@ class MikrotikAPI: # --------------------------- # take_accounting_snapshot - # Returns float -> seconds period between last run and current run + # Returns float -> period in seconds between last and current run # --------------------------- def take_accounting_snapshot(self) -> float: """Get accounting data""" diff --git a/docs/assets/images/ui/accounting_sensor.jpg b/docs/assets/images/ui/accounting_sensor.jpg new file mode 100644 index 0000000..10583ed Binary files /dev/null and b/docs/assets/images/ui/accounting_sensor.jpg differ