I know the port 9999 was defined by TP-Link, but I want using router's port mapping function to control the device from Internet. Now I am using MQTT to make this application, but i need a station (maybe a raspberry pi) in the LAN. So I want to control HS105 directly form internet when many HS105 in LAN ...
I am also using tcp/udp client function sending the control command to control the HS105 directly.
I just want python-kasa can offer the function to change the port ...
Activity
kirichkov commented on Oct 26, 2020
If I understand your question correctly, and you are referring to port 9999, then no - you cannot, this is defined by TP-Link in their firmware.
yutangshen commented on Oct 27, 2020
I know the port 9999 was defined by TP-Link, but I want using router's port mapping function to control the device from Internet. Now I am using MQTT to make this application, but i need a station (maybe a raspberry pi) in the LAN. So I want to control HS105 directly form internet when many HS105 in LAN ...
I am also using tcp/udp client function sending the control command to control the HS105 directly.
I just want python-kasa can offer the function to change the port ...
kirichkov commented on Oct 29, 2020
Do you use python-kasa as a command-line binary or as a module - i.e. you have written your own python program?
yutangshen commented on Oct 30, 2020
Thanks for commect
Now, I am using encode function encode command to control my device directly by tcp/udp ...
kirichkov commented on Oct 30, 2020
Let me look into it
kirichkov commented on Oct 31, 2020
In #109 I've exposed setting a port in TPLinkSmartHomeProtocol.query. My understanding is that that's what you're using to control your devices.
Just a word of caution - exposing your devices to the Internet can lead to disastrous results.
yutangshen commented on Oct 31, 2020
Thanks for the caution, and i will try TPLinkSmartHomeProtocol.query function ..
My device was exposing in VPN environment, so that is relatively safe ...
kirichkov commented on Oct 31, 2020
Indeed if you can test it before it gets merged, it'd be great.
rytilahti commented on Sep 27, 2021
The target port can be changed by monkeypatching DEFAULT_PORT in the Protocol class: https://github.com/python-kasa/python-kasa/blob/master/kasa/protocol.py#L29 - I don't think it makes sense to make that configurable after all, so I'll close this issue now.
Prepare 0.4.1
Prepare 0.4.1 (#288)
Prepare 0.4.1 (python-kasa#288)