mihai-dinculescu / tapo

Unofficial Tapo API Client. Works with TP-Link Tapo smart devices. Tested with light bulbs (L510, L520, L530, L610, L630), light strips (L900, L920, L930), plugs (P100, P105, P110, P115, P300), hubs (H100), switches (S200B) and sensors (KE100, T100, T110, T300, T310, T315).
MIT License
313 stars 30 forks source link

P115 changing WI-FI #199

Open DrAssExplosion opened 2 months ago

DrAssExplosion commented 2 months ago

Hi

I would like to change the WI-FI for the outlet, without having to install the Tarot application, using the example of the set_qs_info method from https://gitlab.com/0xSamy/TapoPlug-Rest-API/-/blob/master/tapo_plug/tapoPlugApi.py

That is, I reset the settings, connected to WI-FI "Tapo_Plug_XXXX", and sent a request to 192.168.0.1, but if I do this, then in the "handshake1" method - server_hash will differ from local_hash and nothing will work

So is there a way to do this? Maybe when the settings are reset, a different connection method or a special username/password is used?

Thank you in advance

mihai-dinculescu commented 2 months ago

Have you tried calling .refresh_session()?

DrAssExplosion commented 2 months ago

I'm sorry, the translator accidentally translated "Tarot", I wanted to write an application "Tapo"

I'm afraid to call .refresh_session() will not work because first we create a device let my device = ApiClient::new(tapo_username, tapo_password).p110(ip_address).await?; and then device.refresh_session().await;

But the call occurs along the following chain .p110(ip_address) -> login(ip_address) -> KlapProtocol.login() -> handshake() -> handshake1(), and in handshake1 the incorrect "local_hash" and "server_hash" are generated, .refresh_session() also causes handshake()

In general, the idea is to assemble a *.exe file that will scan the network, connect to the device's WI-FI and connect the device itself to the home network (what the Tapo mobile app does) Only without the need for the user to install this application

mihai-dinculescu commented 2 months ago

Ah, I see. So you basically want to be able to set up the wifi of a new device or a device that's been reset programmatically?

DrAssExplosion commented 2 months ago

I think it would be nice in both cases (if possible) For example, if you take a new outlet P115, connect it using the "Tapo", then reset it by pressing the button on the outlet itself (+- 5 sec.) then, when reconnecting, "Tapo" will detect some part of the old settings and offer to use them Therefore, it is not clear whether these old settings are used when reconnecting or not

mihai-dinculescu commented 2 months ago

Yes, it sounds useful to add, indeed. I'm happy to talk over contributions if someone is willing to add support for this.