Kane610 / aiounifi

Asynchronous library to communicate with Unifi Controller
MIT License
59 stars 51 forks source link

Add traffic routes #528

Closed shaunpearsondev closed 9 months ago

shaunpearsondev commented 9 months ago

As mentioned in #522 This adds the ability to list and toggle traffic routes

Very heavily follows the work on traffic rules

Tested against

UDM SE v3.1.16 Network 7.5.187

result = await controller.request(TrafficRouteListRequest.create())
LOGGER.info(result)
route = controller.traffic_routes["_id"]
result = await controller.request(
        TrafficRouteEnableRequest.create(deepcopy(route.raw), False)
    )
LOGGER.info(result)
Kane610 commented 9 months ago

Please fix so tests pass. Preferably you utilise the setup.sh script to get pee commit hools going as well.

Looked through the code and it looks good (indeed very much similar to traffic rules). Gonna look through it again tomorrow

shaunpearsondev commented 9 months ago

Sorry windows user here 😳

I ran the following adapted script and all tests and pre commit hooks seem to be passing except the test_websocket one I can't see where I would of broken this so hoping it is a windows quirk...

python3 -m venv venv

./venv/Scripts/Activate.ps1

python3 -m pip install --upgrade pip

python3 -m pip install .[requirements,requirements_test,requirements_dev]

pre-commit install
Kane610 commented 9 months ago

Thank you very much!

Would you mind doing a follow up PR that introduces a couple of test cases that has some errors from the API, would be beneficial for this https://github.com/Kane610/aiounifi/pull/520