tomaae / homeassistant-mikrotik_router

Mikrotik router integration for Home Assistant
Apache License 2.0
309 stars 53 forks source link

[Bug] Attribute Interface does not update for device_tracker entries #202

Closed mattmole closed 2 years ago

mattmole commented 2 years ago

Hi,

When moving between interfaces (I use CAPSMAN and a second device in my office to extend wifi range), the Interface attribute does not update when it changes. I'd like to use this for notifications based on which AP I am connected to.

image

Happy to help if I can

tomaae commented 2 years ago

Interface is taken from /caps-man/registration-table Check if it is updated correctly in mikrotik.

Also, how did you open this issue? It should not be possible to open blank issues.

mattmole commented 2 years ago

Hi,

Yes it does update correctly within the caps-man registration table. I can see in there either mattnet or office, depending on which AP I'm connected too.

I opened the issues tab on GitHub, created a new one and logged in. I then filled in fields and submitted. What did I miss out? Sorry!

On Tue, 17 May 2022, 15:34 Tomaae, @.***> wrote:

Interface is taken from /caps-man/registration-table Check if it is updated correctly in mikrotik.

Also, how did you open this issue? It should not be possible to open blank issues.

— Reply to this email directly, view it on GitHub https://github.com/tomaae/homeassistant-mikrotik_router/issues/202#issuecomment-1128949745, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRRJ3PR7GRDIPSFMBU3Q33VKOU7LANCNFSM5WEWW5OA . You are receiving this because you authored the thread.Message ID: @.***>

tomaae commented 2 years ago

Ok, can you debug it and simulate movement to other AP? If it is in registration table, it should be reflected in HA.

Can you tell me how exactly did you opened it? I dont think you did anything wrong, I just need to figure out how are these blank issues created. Since they are disabled and only templates are available in issue tab.

tomaae commented 2 years ago

This is what you should see: image

mattmole commented 2 years ago

Sure, I'll do that when the kids are in bed and report back to you - thanks

On Tue, 17 May 2022, 17:00 Tomaae, @.***> wrote:

This is what you should see: [image: image] https://user-images.githubusercontent.com/23486452/168856302-19b1ec5e-ac2c-439d-81ac-733bb338170b.png

— Reply to this email directly, view it on GitHub https://github.com/tomaae/homeassistant-mikrotik_router/issues/202#issuecomment-1129047689, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRRJ3KJ4KL3E3ZP7RQHO2TVKO7AZANCNFSM5WEWW5OA . You are receiving this because you authored the thread.Message ID: @.***>

mattmole commented 2 years ago

Hi again, regarding the creation of blank issues. I've been able to recreate this...

1) Make sure github is not logged in 2) Go to the issues page 3) Create new issue 4) When asked login

You'll now be presented with a blank issue and don't get asked to select a template

mattmole commented 2 years ago

Regarding the main issue, I can see in winbox that my phone has moved across to the Office-2 interface...

image

But in HA, the attribute for this phone is showing as Mattnet-1 stil.

image

See screenshot below for my settings. Do I need to wait the 1300s for this value to change? I take it scan interval is in seconds?

image

I'm running the following:

Home Assistant Core 2022.5.4 Home Assistant Supervisor 2022.05.2 Home Assistant OS 8.0 Kernel version 5.15.32-v8 Agent version 1.2.1

HACS 1.24.5

Mikrotik Router 2.0

tomaae commented 2 years ago

I will need to see debugs to see whats going on. We know its correct in winbox, but I need to see what integration does internally in this case. I dont use mikrotik wifi at all, so I can only work here based on debugs. Btw, you can also look into diagnostics for integration, I expect it will show correct location there.

Btw, thanks for helping me to figure out the mystery of blank issues :)

mattmole commented 2 years ago

Hi Tomaae,

See below for a couple more screenshots. The one that shows the correct Interface attribute is using the "official" Mikrotik integration.

Is it possible for me to share the debug info with you directly? Even though mac-addresses are shown as redacted, they are actually shown.

HACS Mikrotik integration: HACS Mikrotik Integration

Official Mikrotik integration: Official Mikrotik integration

Mikrotik app: Mikrotik App

I wonder if I have caused the issue by renaming the entity Id and entity name?

Thanks

tomaae commented 2 years ago

I have redid tracked host updating in 0da0f876c381a7c4a95d9add85c84e405260ec7e, can you test it again with master?

mattmole commented 2 years ago

Thank you. I've installed the master branch now and will report back tomorrow when I've done some testing.

Matt

On Wed, 18 May 2022, 20:31 Tomaae, @.***> wrote:

I have redid tracked host updating in 0da0f87 https://github.com/tomaae/homeassistant-mikrotik_router/commit/0da0f876c381a7c4a95d9add85c84e405260ec7e, can you test it again with master?

— Reply to this email directly, view it on GitHub https://github.com/tomaae/homeassistant-mikrotik_router/issues/202#issuecomment-1130428145, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRRJ3I3CXZZAP56OMLIXYLVKVAPJANCNFSM5WEWW5OA . You are receiving this because you authored the thread.Message ID: @.***>

mattmole commented 2 years ago

Hi again,

I tried that earlier today and it worked for me. Did you find a logical flaw in the old implementation?

Matt

On Wed, 18 May 2022, 21:12 Matthew Holder, @.***> wrote:

Thank you. I've installed the master branch now and will report back tomorrow when I've done some testing.

Matt

On Wed, 18 May 2022, 20:31 Tomaae, @.***> wrote:

I have redid tracked host updating in 0da0f87 https://github.com/tomaae/homeassistant-mikrotik_router/commit/0da0f876c381a7c4a95d9add85c84e405260ec7e, can you test it again with master?

— Reply to this email directly, view it on GitHub https://github.com/tomaae/homeassistant-mikrotik_router/issues/202#issuecomment-1130428145, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRRJ3I3CXZZAP56OMLIXYLVKVAPJANCNFSM5WEWW5OA . You are receiving this because you authored the thread.Message ID: @.***>

tomaae commented 2 years ago

Hi again,

I tried that earlier today and it worked for me. Did you find a logical flaw in the old implementation?

Matt

On Wed, 18 May 2022, 21:12 Matthew Holder, @.***> wrote:

Thank you. I've installed the master branch now and will report back tomorrow when I've done some testing.

Matt

On Wed, 18 May 2022, 20:31 Tomaae, @.***> wrote:

I have redid tracked host updating in 0da0f87 https://github.com/tomaae/homeassistant-mikrotik_router/commit/0da0f876c381a7c4a95d9add85c84e405260ec7e, can you test it again with master?

— Reply to this email directly, view it on GitHub https://github.com/tomaae/homeassistant-mikrotik_router/issues/202#issuecomment-1130428145, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACRRJ3I3CXZZAP56OMLIXYLVKVAPJANCNFSM5WEWW5OA . You are receiving this because you authored the thread.Message ID: @.***>

I just changed update logic. Originally it was just filling missing data over time, so attribute update would not happen once set. I guess I didn't really considered mesh and uplink setups. Not many use it, so I it took all this time to find that design flaw.