MarkGodwin / tplink-omada-api

MIT License
12 stars 9 forks source link

Add methods to retrieve and change verify_ssl_switch #39

Open lukshan13 opened 3 months ago

lukshan13 commented 3 months ago

To facilitate dynamic control of SSL Verify, once an integration has already been added into home assistant, added new methods in the following files:

omadaapiconnecttion.py

get_verify_ssl_switch() -> Bool : retrieves current state of 'verify_ssl' class property set_verify_ssl_switch(bool) -> None : sets 'verify_ssl' class property

omadaclient.py

get_verify_ssl_switch() -> Bool : Wrapper function for apiconnection set_verify_ssl_switch(Bool) -> None : Wrapper function for apiconnection

Next steps: Once merged, add method in HomeAssistant core Omada integration to show and modify the state from integration settings

references issue #40

lukshan13 commented 3 months ago

Btw, i made a pull request into the branch that I thought was appropriate. LMK if i need to merge this into master on my end first, then make a pull request to your repo

MarkGodwin commented 3 months ago

I think this will probably work, but I'm not sure it's necessary. It's unlikely you'd need to change the verify_ssl flag dynamically. I would have thought you'd want to change the connection address, port number, etc. more often than the verify flag, and the API doesn't allow that either. However... I think if the flag value needs to be changed, you would just dispose of the API object and create whole a new one with the updated connection values. I don't see there is a need to keep the same OmadaClient if you want to change the verify_ssl flag.

But, if you really want this change in, I guess I don't have a problem with merging it.