Isaksson / node-red-contrib-unifi

MIT License
50 stars 19 forks source link

Add support for trafficroute endpoint #123

Closed ackjewtn closed 7 months ago

ackjewtn commented 7 months ago

Added functions to disable, enable and get trafficroutes. This would make it possible to disable or enable routing via node-red.

Isaksson commented 7 months ago

Hello. Maybe I am missing something here but it only seems that you changed name on the function disableTrafficManagementRule to disableTrafficRouteRule, so this does not add any new function its just a name change?

The function to get, enable and disable is already in the code.

<li><code>enableTrafficManagementRule</code> : Enable a traffic management rule { command: "enableTrafficManagementRule", rule_id: "id" }</li> <li><code>disableTrafficManagementRule</code> : Disable a traffic management rule { command: "disableTrafficManagementRule", rule_id: "id" }</li> <li><code>getTrafficManagementRule</code> : Get traffic management rules, optional add rule_id { command: "getTrafficManagementRule", rule_id: "id" }</li>

ackjewtn commented 7 months ago

No, this is a different API call. They are very similar to the "traffic management" calls.

The functionality i added calls the /v2/api/site/<SITE>/trafficroute/ endpoint instead of /v2/api/site/<SITE>/trafficrules/ - the only thing that differs between the calls is the URL.

E.g. trafficroute maps to Settings -> Routing -> Traffic Routes in the UI, whereas trafficrules is located under Settings -> Security -> Traffic Rules

Isaksson commented 7 months ago

Ahh I see, thanks for clearing this out

Isaksson commented 7 months ago

I cant Merge the pull request, because you have changed the entire README.md file, the unifi-helper.js and unifi.js is ok. Please just remove the readme file from the pull request and I will handle the change in that file. Thanks.

ackjewtn commented 7 months ago

@Isaksson done!

Isaksson commented 7 months ago

Thanks.