tomaae / homeassistant-mikrotik_router

Mikrotik router integration for Home Assistant
Apache License 2.0
292 stars 48 forks source link

Kid Control parameters show in logs but are not available as entities #312

Closed Extrapilot1 closed 9 months ago

Extrapilot1 commented 10 months ago

Describe the issue

If Kid Control is enabled, along with logging, you will see what is expected- entries for what you see in the Kid Control table (name, mac, IP, RX/TX counters, and activity (connected domain/system). But while enabling Kid Control in the integration shows this data in the log, there are no entities added to the summary within the Integration (X devices and Y entities), and the kid-control Device entries are not accessible- only the Table entries are ( the kid name as enabled or disabled, and the core module as enabled or disabled

How to reproduce the issue

Just enable the Kid Control option in the Integration, and add a basic Monitor 'kid' to the Kids tab as per the guidance for the Integration. Enable logging. You will see the Devices info in the log, but no new entities are available in HA from the Devices tab- which is with the new Router OS about the only way to do port monitoring.

Expected behavior

Info from Devices tab should appear as functional entities in HA as with other modules- Firewall, Interface, etc.

Software versions

tomaae commented 10 months ago

I'm not sure I understand. are you not getting any kid control entities?

Extrapilot1 commented 10 months ago

What I see are the 2 'kids' (kid1, and monitor), and then 2 switches for their enable/pause state. So, 4 total entities are exposed via any tools/cards I have- Autoentities for example. I see none of the entries listed in the Kid Control/Devices tab, where you have the actual device names, IPs, macs, etc shown.

In the log, I see a response from the router with all the devices that were active at that time (I included only a couple, as machine names arent redacted, but the first 2 have no registered machine name). But none of this data is present in HA. Its strange, because the return format seems to be effectively identical to that for the /ip/kid-control return, but where those are present in HA, the ip/kid-control/device return is not present in HA. 2023-10-03 15:52:40.464 DEBUG (SyncWorker_4) [custom_components.mikrotik_router.mikrotikapi] API query: /ip/kid-control/device 2023-10-03 15:52:40.511 DEBUG (SyncWorker_4) [custom_components.mikrotik_router.apiparser] Processing source [{'.id': '*1', 'name': '', 'mac-address': '**REDACTED**', 'user': '', 'ip-address': '**REDACTED**', 'activity': 'ota.nvidia.com', 'rate-down': 0, 'rate-up': 0, 'bytes-down': 153659088, 'bytes-up': 31694348, 'idle-time': '1s', 'dynamic': True, 'blocked': False, 'limited': False, 'inactive': False, 'disabled': False}

tomaae commented 10 months ago

You say that you see both entities per entry, yet you dont see them? I dont get what is a problem at all. Maybe try to take some screenshots or check if there is some typo on your message.

Extrapilot1 commented 10 months ago

I dont know why this is so difficult for you to follow. There are 2 core tabs in the MT GUI for Kid Control. One lists the physical 'kids,' which no one cares about for this integration, and the other lists the physical devices- IPs, names, bandwidths, and totals- the things we actually want to capture and use for triggers/alarms etc.

In HA, the only elements that are exposed to the are the kids, NOT the data that we care about. But that data we want is shown in the log- your API queries for /ip/kid-control/device, and the data is sent, but the integration doesnt do anything with it.

tomaae commented 10 months ago

Data from /ip/kid-control/device is available in integration too, it is classified as client traffic sensors. Once enabled, just click on integration in UI and you will see all those devices, including current bandwith used and totals. For this, you dont need to have Kid Control enabled in integration configuration, just in mikrotik since routeros v7, so it tracks clients.

I'm not sure if you just didnt noticed them or need some additional information to be presented through integration.

Extrapilot1 commented 10 months ago

I will check- thanks for the info. I dont know why it isnt showing up in a control like the all-entities card. Maybe they are hidden by default.

Incidentally, there may be something else going on with units. I was looking at the Interface list. It seems that Byte counters in Winbox are showing up correction (i.e. I download a 600MB file, I see about 620MB in RX Bytes. But in the Integration, this seems to require the Units to be set to Mbit. I dont know if translation happens in the Integration, or if MT is exporting incorrectly etc. Seems like an error people would notice regardless of where it is, but I will check the log files and see what is reported. If a bug seems to exist, Ill file it here.

Thanks again.

tomaae commented 10 months ago

They should not be hidden by default, at least not from integration side. Once you enable it, all devices should show up: image

Units are converted by HA now. I set some defaults that make sense to me, but you can change it into any unit and unit precision you like in entity settings. Many integrations are now compatible with this system, you may find it useful.

github-actions[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

github-actions[bot] commented 9 months ago

This issue was closed because it has been stalled for 5 days with no activity.