HS300 returns 5 children (plugs), when 6 is expected
See original GitHub issueThe HS300 has 6 outlets.
When I send command:
./tplink_smartplug.py -t HS300 -c info
I receive:
Sent: {"system":{"get_sysinfo":{}}} Received: {"system":{"get_sysinfo":{"sw_ver":"1.0.10 Build 190103 Rel.163517","hw_ver":"1.0","model":"HS300(US)","deviceId":"<obfuscated>","oemId":"<obfuscated>","hwId":"<obfuscated>","rssi":-68,"longitude_i":<obfuscated>,"latitude_i":<obfuscated>,"alias":"TP-LINK_Power Strip_0320","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"<obfuscated>","updating":0,"led_off":0,"children":[{"id":"<obfuscated>00","state":0,"alias":"outside fan","on_time":0,"next_action":{"type":-1}},{"id":"<obfuscated>01","state":1,"alias":"inside fan","on_time":1352807,"next_action":{"type":-1}},{"id":"<obfuscated>02","state":1,"alias":"Plug 3","on_time":1398685,"next_action":{"type":-1}},{"id":"<obfuscated>03","state":1,"alias":"Plug 4","on_time":1398685,"next_action":{"type":-1}},{"id":"<obfuscated>04","state":1,"alias":"Plug 5","
as you can see it stops at Plug 5, and it doesn’t finish
When I change
data = sock_tcp.recv(2048)
to
data = sock_tcp.recv(4096)
I then receive all 6 children. Was this the correct fix?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top GitHub Comments
I just spotted the formatting was wrong on my comment, updated. Don’t call decrypt on data2[4:] as that’s where the four bytes are being dropped, you need to append data and data2, then drop four bytes of both, it’s this line that you need “decrypt(data[4:] + data2)”
For testing I used the history functions which returns much larger values and so hit this case most invocations rather than simple reads which rarely exhibit it.
Thanks Ashley, I tried some of your code, you’re doing something with json which wasn’t part of the original, so I left it out. As you can see, I am missing 5 bytes in the “id” for outlet id ending in “404”.
Results:
{"id":"80066DED8DED9E47F301DCAA593661321B80D21403","state":0,"alias":"4 UV Light","on_time":0,"next_action":{"type":1,"schd_sec":68460,"action":1}}, {"id":"80066DED8D07F301DCAA593661321B80D21404","state":0,"alias":"5 Main Fans","on_time":0,"next_action":{"type":1,"schd_sec":68400,"action":1}}, {"id":"80066DED8DED9E47F301DCAA593661321B80D21405","state":1,"alias":"6 Veg Light","on_time":162304,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}}