-
-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add traffic rules to library #409
Conversation
Hello! Thank you for your PR, I started doing a review but got lost in other stuff, I will get back to you shortly! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its a good start, but some improvements are needed and of course tests.
I was working on some other projects and was on holiday. I will start implementing the requested changes and start adding the tests. |
I recommend starting with doing a rebase as I've refactored some aspects lg the library |
Ok, I started with a rebase and I'm not completely done yet (still some cleaning up to do of the code and I still need to squeeze an "update" of the traffic rules in the code since the Unifi console does not send messages about these changes). |
Take your time! |
I made the requested modifications, and based it on the new structure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would be helped setting up the dev env in a python3.11 venv and using the pre-commit tool. You can run the setup.sh script to do that, there are a lot of small things which would be caught by that.
Yes we need to figure out a way to specify different expected data structures from different api endpoints. Maybe have some transform in the ApiRequest class |
Good progress! I will be away a few days now so gonna be hard to get this in for 2023.9 release, but only a few things left to resolve |
Did it again, mistakenly closed the PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some small comments to move you along :)
I hope with the latest commits I am almost there |
I've made some modifications to the prepare_data method I introduced.
Maybe it is more logical to place this elsewhere, but now the complexity of parsing different response structures is already concentrated in one place. |
I only had a few minutes tonight, will look more tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even closer! Some things left. You shouldn't really need to change any existing test if we do this properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're getting there! Try to take a step back and simplify what we've discussed and I think it's ready. I will need to rework a bit about where data response is parsed and error handling and stuff, it clearly doesn't work well with multiple data structures... But lets keep that out of this PR as much as possibly.
I have not much time in the coming days, but I will take a closer look at everything this weekend. |
Donit at your pace. I'm also away |
…e aiounifi library.
What happened? |
I reverted those changes back, was a bit unfortunate of me. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like your improvements it fits well in with the overall structure.
Only more would be to handle response differences in the response rather than request class, but that's more work and let's keep out of it.
Remove unnecessary import Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Remove unnecessary import Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
Remove unnecessary import Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
…uestV2-base class.
I glanced from the phone and it looks really good. Will review tomorrow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im very happy with how this turned out. You did a great job!
I saw one thing that warrants a fix, test coverage
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 🎉
Anything more you want to do here or are you ready to get this merged?
I am ready to get this merged. Thank you for your time and effort for guiding me. |
Really good job! |
I stumbled on this PR as I was looking to do something like it myself. Not only was I glad to see it was done (yesterday, no less!), I found this PR to be overall super uplifting. @Kane610 your feedback and attitude was terrific and inspirational. @herriejr your persistence and open mindedness to learn was impressive. Really great job! Reading this made me feel good about open source, so I figured I’d share so you two can feel good about being a part of it. Kudos and thank you! |
Thank you very much @ViViDboarder <3 |
@herriejr I will wait to build a release some more time, you should be perfectly fine doing a local install into the home assistant environment directly from the aiounifi clone. Ping me when you need to. |
I've got it working locally. Gonna let it rest for a few days and then look at it again and try to clean the code up. I'll keep you posted. |
@herriejr FYI I've published aiounifi v64 as I needed to propagate a fix to home assistant. |
I will be away for work the upcoming week. I will then look into it. |
Thank you. That will be fine |
Adds support for reading, enabling, disabling, as well as generally updating Traffic Routes. I based this off the PR Kane610#409
With these changes, it is possible to control the trafficrules, defined in the unifi network management.
At this moment you can enable and disable a selected traffic rule.
(pls bear with me, since this is my 1st pull request)