Added AsusWRT device import plugin - #958
Conversation
|
Hey @labmonkey, Thanks a lot for the contribution 🙏 |
|
Thanks a lot. BTW regarding my comment It will correctly update the device online/offline status and IP address but If the |
|
Hi there!
You are right, only certain values are updated in NAX after initial
discovery. The idea is that NAX is the source of truth for names. I could
think of adding an option to override the behaviour, but that's an
intentional design decision for now.
Hope that makes sense. Happy to hear opinions 🙂
Thanks again,
J
…On Thu, 16 Jan 2025, 22:52 Paweł Derehajło, ***@***.***> wrote:
Thanks a lot. BTW regarding my comment In case an existing imported
device is renamed in Asus Router it will not be renamed in NetAlertX. In
this case it has to be done manually or the device should be removed and it
will appear on the next scan. Is there any way around this? I've noticed
that even If I repeat the following command on existing device:
plugin_objects.add_object(
primaryId=entry_mac,
secondaryId=handleEmpty(device.connection.ip_address),
watched1=handleEmpty(device.description.name),
watched2=handleEmpty(device.description.vendor),
extra=pluginName,
foreignKey=entry_mac,
)
It will correctly update the device online/offline status but If the
watched1 or watched2 change it will not update those. I would assume that
it compares the devices by primaryId that is the MAC address but the rest
seems to be ignored?
—
Reply to this email directly, view it on GitHub
<#958 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AW5URDGXBBMBJBAN36BCWQT2K6MQPAVCNFSM6AAAAABVIS2D42VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOJVGMYTQMBWGE>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
|
Hi. I see your point and I agree that there should be one source of truth. Let me describe a little issue I am facing. So far I was naming all my devices in my Router. Just for easier administration. I thought that I could just keep them in sync with NAX and have one less thing to think about. The initial import works flawlessly as designed and has all the up to date information. I made two tests where things become a little bit different:
As you can see the behaviour is different although I can totally understand that it is better to allow renaming unnamed devices rather than have no name at all. The reason I was testing that is because in a real world scenario as soon as a new device joins my network the Router will give it an initial name most likely based on its hostname that sometimes is descriptive enough and sometimes just a not human friendly device model. This means that each new device will be imported into NAX with some name before I even get a chance to give it a normal name in my Router (assuming my cronjob is triggered every 5 minutes). Not judging anything here, just wanted to give you the idea of what can happen. So just to wrap it up I think that the current behaviour is not that big of an issue, at least to me as I don't have that many devices but I had an idea that can work around this problem. I've noticed that I can also work with the DB in my plugin so it is possible to do things such as: So each time a device is imported I could check if the name changed an just trigger a proper SQL. Since by design NAX is source of truth I think there could be a flag in my plugin settings where an user could decide if he wants to allow this to happen. I just don't know how much this would be convenient alternative or going against the rules, what do you think? |
|
Thanks a lot for the in-depth answer. I agree, that the 5 min interval is too short to get any edits done before the device is imported. In some other plugins, I believe in the Mikrotik and Omada ones, what the developers have allowed is updating the device name in NAX and then syncing the new name into the router. Not sure if Asus has a write API for this purpose though. I also understand that this would shift your workflow a bit, so not sure if that's something you would entertain. Regarding DB access, that's true. It's as simple as to run a query, but it's going against some design decisions and should be used in edge cases, as the system monitors the Or it could be a simple setting ( Anyway - let me know what are your thoughts. you can have a look at the code here as well: https://github.com/jokob-sk/NetAlertX/blob/a16c2dfed647f9e457ed189dd4cd0ec84e392204/server/device.py#L314 |
|
Thanks for explaining this. I'm not sure if Asus has a write API but I also cannot find anything like this in the library I am using. Anyway I think it would be more than I am currently motivated to work on :-) With the DB as I expected running SQL directly is risky, but that was just an idea do discuss. |
|
thanks @labmonkey - I will consider these improvements in the future :) |

You can now import your devices from AsusWRT routers. Check Readme for more info.
Fixes #624