Comments (26)
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.
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.
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.
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.
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.
Thanks, I look forward to work with you on more improvements :)
from homeassistant-mikrotik_router.
could you redo the accounting screenshot and save it as png when you have time? that jpg has artifacts.
from homeassistant-mikrotik_router.
#27 PR open
from homeassistant-mikrotik_router.
thank you, now they look perfect side by side :)
from homeassistant-mikrotik_router.
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.
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
Device trackers show state "Unavailable" but the icon for connected/disconnected is okay
In integration groups I got new group for each connected host (Mikrotik {hostname}) , which only contain device tracker entity for that host.
And system, queues, NAT groups are renamed to Mikrotik system, Mikrotik queues, Mikrotik NAT..
Group Accounting is not present anymore.
from homeassistant-mikrotik_router.
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.
Looks good now!
from homeassistant-mikrotik_router.
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.
I have tried enabling accounting on my router, but it does not show correct values:
WAN TX seems to be accurate, but RX is way off. I did not see anything obvious in code.
from homeassistant-mikrotik_router.
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.
thats fine, no worries about how long it takes. this is not a paid job you know :)
from homeassistant-mikrotik_router.
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.
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.
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.
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.
Great :)
from homeassistant-mikrotik_router.
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.
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.
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.
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)
- [Feature] New sensor: container HOT 4
- [Question] Why not all NAT rules showing as switches HOT 5
- Router OS 7.13, integration not work HOT 2
- [Question] Device not shown as Online when using "wifiwave2 capsman" HOT 1
- [Bug] HOT 8
- Integration didn't pick-up my Netwatch items HOT 8
- [Bug] This HAS addon is breaking Map functionality HOT 5
- [Bug] 'Failed setup, will retry' only for a couple of RBs HOT 1
- [Bug] RouterOS version becomes Unknown HOT 5
- [Question] invalid password with password length > 9 chars, is there a hardcoded limit? HOT 11
- [Bug] Filter rules removed as duplicate, miscalculated unique ID? HOT 4
- [Bug] Upgraded my hap ax2 to 7.13.4 error mesage failed setup will retry HOT 2
- [Bug] unable to install version from master via HACS HOT 1
- [Bug] CCR1016-12G will not connect HOT 3
- Hap ax3 HOT 12
- [Feature] Monitoring of SFP module - temperature, voltage, etc. HOT 1
- Show unit conversion example HOT 5
- List IP Routes with status flags HOT 3
- [Bug] Traffic TX/RX Total incorrect HOT 12
- [Bug] Not working with RouterOS 7.14.1 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homeassistant-mikrotik_router.