tplink-smarthome-api icon indicating copy to clipboard operation
tplink-smarthome-api copied to clipboard

Configure the SSID

Open markorajevic opened this issue 5 years ago • 6 comments

Hi,

I wasn't able to find it in the documentation, but is it possible to send SSID & Password to plug somehow? So far I wasn't able to configure it in that way.

Post update:

Possible. {"netif":{"set_stainfo":{"ssid":"WiFi","password":"secret","key_type":3}}}

markorajevic avatar Feb 11 '19 22:02 markorajevic

You can send a custom command using send or sendCommand. I did not include a function for this as I didn't see it's use as the device would have to be on the network already to receive the command. How are you using it?

plasticrake avatar Feb 15 '19 21:02 plasticrake

I second this. I would like to be able to provision plugs automatically for a large scale project. After connecting to the local plug wifi, send new wifi config and go from there.

dustingraves avatar May 17 '19 22:05 dustingraves

Wifi configuration only seems to be possible when the device is in setup mode.

dustingraves avatar May 17 '19 22:05 dustingraves

@dustingraves Actually, I am sending this code manually for configuration: let data = { "netif": { "set_stainfo": { "ssid": "ssid_name", "password": "password_here", "key_type": 3 } } }

markorajevic avatar May 17 '19 23:05 markorajevic

I was really hoping to have this work as I was needing to migrate from one network SSID to another and I didn't want to have to reset the devices and set up my schedules from scratch.

Unfortunately the command seems to work on my HS110 but not the HS105, HS300, or LB110 devices...

pi@WimPi4:~/tplink-smartplug $ tplink-smarthome-api send 192.168.0.40 '{"netif":{"set_stainfo":{"ssid":"WiFi","password":"secret","key_type":3}}}'
Sending to 192.168.0.40: via tcp...
response:
{ netif: { set_stainfo: { mac: 'B0:4E:26:AE:4B:47', err_code: 0 } } }
pi@WimPi4:~/tplink-smartplug $ tplink-smarthome-api send 192.168.0.41 '{"netif":{"set_stainfo":{"ssid":"WiFi","password":"secret","key_type":3}}}'
Sending to 192.168.0.41: via tcp...
response:
{ netif: { set_stainfo: { err_code: 0 } } }

The first device I was trying happened to work and the device reconnected to my new SSID, and the response included the MAC ID. All the other devices responded without the MAC ID and remained on the old SSID.

If you have any other suggestions for me to investigate, I'd love feedback.

wcbonner avatar Feb 16 '20 05:02 wcbonner

This would be helpful. For some reason the Kasa app does not register the HS220 I have correctly. It would be nice to be able to just send the network info from my laptop while connected to the switch's setup WiFi and not have to deal with the app on my phone.

mikejr83 avatar Jun 23 '21 13:06 mikejr83