GithubHelp home page GithubHelp logo

Comments (26)

tomaae avatar tomaae commented on May 29, 2024

It could be useful for sure. That way it should be possible to monitor devices connected over wifi or switches.
Is it only IP based or is it possible to base it on MAC address? MAC address would be best of course because of DHCP.

For this we would probably also need a small guide how to set it up in routeros.
We should probably call this device "Accounting" instead of "Traffic" internally and in the integration (device_info > name), so its clearly separated from per port traffic.

from homeassistant-mikrotik_router.

ivanpavlina avatar ivanpavlina commented on May 29, 2024

Device name "Accounting" would be smarter, i agree.

Yeah, accounting is IP based, it is returning Src. Address, Dst. Address, Packets (counter) and Bytes (counter)
MAC address for local hosts (which would be generated for sensors) could be retrieved from ARP List, every host should be present there and reference by IP address could be made.

from homeassistant-mikrotik_router.

tomaae avatar tomaae commented on May 29, 2024

ah right, its easy to access arp and dhcp server for mikrotik.
yes, with that it should work great. it should also be possible to combine in mikrotik dns server entries for user friendly sensor names (this should be only accessed if the name is unknown to reduce queries).

from homeassistant-mikrotik_router.

tomaae avatar tomaae commented on May 29, 2024

I got many good ideas for improvement from working with you on this, looks like I will be busy :)

Btw, was it easy to work with my code? Any suggestions for improvement to make it easier work work with it in future?

from homeassistant-mikrotik_router.

ivanpavlina avatar ivanpavlina commented on May 29, 2024

Wow sorry, totally missed this update :)

That nice to hear, I really want something to integrate my Mikrotiks in HA as much as possible ^^

As for the code, its nicely structured, don't know what I could suggest because it is written well and I got up and running really fast. Hope I can contribute some more in the future :)

from homeassistant-mikrotik_router.

tomaae avatar tomaae commented on May 29, 2024

Thanks, I look forward to work with you on more improvements :)

from homeassistant-mikrotik_router.

tomaae avatar tomaae commented on May 29, 2024

could you redo the accounting screenshot and save it as png when you have time? that jpg has artifacts.

from homeassistant-mikrotik_router.

ivanpavlina avatar ivanpavlina commented on May 29, 2024

#27 PR open

from homeassistant-mikrotik_router.

tomaae avatar tomaae commented on May 29, 2024

thank you, now they look perfect side by side :)

from homeassistant-mikrotik_router.

tomaae avatar tomaae commented on May 29, 2024

could you update to latest master and check if accounting is now grouped under hostnames and queues are together under "Queues" group?
I had to do some major changes in groups to have HA pair everything with other integrations.

from homeassistant-mikrotik_router.

ivanpavlina avatar ivanpavlina commented on May 29, 2024

Accounting sensors definitions in SENSOR_TYPES are missing definition for path
ATTR_PATH: "accounting"
so they get broken. I fixed that in my instance, but there are more problems.

Accounting sensors are ungrouped
accounting_ungrouped

Device trackers show state "Unavailable" but the icon for connected/disconnected is okay
msi

In integration groups I got new group for each connected host (Mikrotik {hostname}) , which only contain device tracker entity for that host.
Capture

And system, queues, NAT groups are renamed to Mikrotik system, Mikrotik queues, Mikrotik NAT..
Group Accounting is not present anymore.

from homeassistant-mikrotik_router.

tomaae avatar tomaae commented on May 29, 2024

oh, I removed wrong attribute by mistake.
try master now, they should be grouped under host name. if that device has both accounting and is tracked, you should see both tracker and accounting sensor grouped under it.

you have to enable device tracking in integration options. I added it yesterday.

from homeassistant-mikrotik_router.

ivanpavlina avatar ivanpavlina commented on May 29, 2024

Looks good now!

from homeassistant-mikrotik_router.

tomaae avatar tomaae commented on May 29, 2024

I have now removed integration name prefix from tracked hosts and accounting sensors. That did not made much sense.
Now it should be in its final form.

from homeassistant-mikrotik_router.

tomaae avatar tomaae commented on May 29, 2024

I have tried enabling accounting on my router, but it does not show correct values:
image
WAN TX seems to be accurate, but RX is way off. I did not see anything obvious in code.

from homeassistant-mikrotik_router.

ivanpavlina avatar ivanpavlina commented on May 29, 2024

Hmm, I'll check it out, don't know if I'll manage to look at this until weekend tho. Will post findings here..

from homeassistant-mikrotik_router.

tomaae avatar tomaae commented on May 29, 2024

thats fine, no worries about how long it takes. this is not a paid job you know :)

from homeassistant-mikrotik_router.

ivanpavlina avatar ivanpavlina commented on May 29, 2024

Sorry that this took so long.

So, i tested this from my side and accounting calculates everything right, i got real approximate TX and RX values for all devices.
Now, there could be problem with set threshold in Mikrotik, this number sets maximum number of accounting entries that can are saved in Mikrotik's memory. If that number is too low and update interval is too high some packets wont be saved in accounting snapshot, which would lead to broken calculations.

Can you try to test it with mentioned PR and check if you get any warnings about accounting in logs?
Thanks

from homeassistant-mikrotik_router.

tomaae avatar tomaae commented on May 29, 2024

No worries, I will try to test it later today.
I have it set to 8192 with 30 sec query time, so not sure. I dont think I have that much traffic, but we will see.

from homeassistant-mikrotik_router.

ivanpavlina avatar ivanpavlina commented on May 29, 2024

Hmm, yeah, thats the same configuration as mine.. If it isn't the threshold problem i don't have any idea why the calculations arent correct :/

from homeassistant-mikrotik_router.

tomaae avatar tomaae commented on May 29, 2024

I figured it out, it is due to FastTrack.

FastTracked packets bypass firewall, connection tracking, simple queues, queue tree with parent=global, ip traffic-flow(restriction removed in 6.33), IP accounting, IPSec, hotspot universal client, VRF assignment, so it is up to administrator to make sure FastTrack does not interfere with other configuration;

from homeassistant-mikrotik_router.

ivanpavlina avatar ivanpavlina commented on May 29, 2024

Great :)

from homeassistant-mikrotik_router.

tomaae avatar tomaae commented on May 29, 2024

I have updated the documentation so nobody gets confused.
Btw, I also made another integration recently which you may be interested in ;)

from homeassistant-mikrotik_router.

ivanpavlina avatar ivanpavlina commented on May 29, 2024

Are you talking about OMV integration? Yeah, i saw it, I was using OMV until a month ago but i switched to virtualized env and plain ubuntu servers. Good luck with it :)

from homeassistant-mikrotik_router.

tomaae avatar tomaae commented on May 29, 2024

ah okey, I just seen that you had something with OMV :)
I have been using it for a long time as an easy to use debian solution.
Next integration will be for monitoring my linux based backup solution, but that will take some time to get to.

from homeassistant-mikrotik_router.

github-actions avatar github-actions commented on May 29, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from homeassistant-mikrotik_router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.