-
Notifications
You must be signed in to change notification settings - Fork 14
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
Added the ability to toggle the LEDs on the router, and made it possible to read the current state of the LEDs #29
Conversation
tp link c1200 v2 does not have ```/admin/smart_network?form=game_accelerator&operation=loadDevice``` it responds with: ```No root node was registered, this usually happens if no module was installed. Install luci-mod-admin-full and retry. If the module is already installed, try removing the /tmp/luci-indexcache file.``` This causes an error, because json is expected. I added self._smart_network = False to class TplinkC1200Router
Added the option to read out the status of the leds on the router, and the ability to toggle them on and off.
Added led to the dataclass.
Hi. |
Set get_led and set_led under the Archer C1200 class.
Thank you for your reply! |
@swwgames Hi
What do you think? |
I think you are right. |
@swwgames Could you add tests for new methods to test_client.py? |
Ok, I will try to do that. |
Do I need to place the new test under the TPLinkRouterTest class, or do I need to create a new class or function specifically for the Archer C1200? |
Yes, I think it would be better to create a new file test_client_c1200.py and ceate a new class class TestTPLinkC1200Client(unittest.TestCase): |
Right now I have the tests for the led_status and wifi_status functions. Do I need to add all the other tests or is this enough? This is my code so far:
|
You dont need to declare
And it would be great if you write tests
in this MR you dont need test_set_wifi as here is no method for that |
So, is this correct?
|
from test_set_led_on and test_set_led_off delete please response_led_general_read and this block
|
That part is needed, because it is used in the set_led function.
The code checks the current state, if the state is not in the desired state, a request is made to toggle the state. You can't specify to which state it needs to change. |
So setting ON or OFF can be done just by one request self.request('admin/ledgeneral?form=setting&operation=write', 'operation=write') ? it works like switch when you request self.request('admin/ledgeneral?form=setting&operation=write', 'operation=write') it switches to apposite value? |
Yes, Do you think the test script is correct right now? If so, I can add it to my fork and we will be able to merge. |
Thank you for the clarification I have no more question for test script. Lets add it |
I added the test file to my fork. |
@swwgames Thank you! |
It is now possible to get the current status of the LEDs with
And set the LEDs with
This code works for the TP-Link archer C1200 V2
I am positive it will work on other routers.