-
-
Notifications
You must be signed in to change notification settings - Fork 239
Closed
Description
Received a new HS105(US) plug with hardware version 5.0 & software version 1.0.2; it is not discoverable or connectable with kasa:
(python-kasa) derek@ubuntu:~$ kasa --version
kasa, version 0.4.0.dev2
(python-kasa) derek@ubuntu:~$ kasa --host 192.168.45.175 --debug
No --strip nor --bulb nor --plug given, discovering..
DEBUG:kasa.protocol:> (249) {"system": {"get_sysinfo": null}, "emeter": {"get_realtime": null}, "smartlife.iot.dimmer": {"get_dimmer_parameters": null}, "smartlife.iot.common.emeter": {"get_realtime": null}, "smartlife.iot.smartbulb.lightingservice": {"get_light_state": null}}
DEBUG:kasa.protocol:Unable to query the device, retrying: unpack requires a buffer of 4 bytes
DEBUG:kasa.protocol:> (249) {"system": {"get_sysinfo": null}, "emeter": {"get_realtime": null}, "smartlife.iot.dimmer": {"get_dimmer_parameters": null}, "smartlife.iot.common.emeter": {"get_realtime": null}, "smartlife.iot.smartbulb.lightingservice": {"get_light_state": null}}
DEBUG:kasa.protocol:Unable to query the device, retrying: unpack requires a buffer of 4 bytes
DEBUG:kasa.protocol:> (249) {"system": {"get_sysinfo": null}, "emeter": {"get_realtime": null}, "smartlife.iot.dimmer": {"get_dimmer_parameters": null}, "smartlife.iot.common.emeter": {"get_realtime": null}, "smartlife.iot.smartbulb.lightingservice": {"get_light_state": null}}
DEBUG:kasa.protocol:Unable to query the device, retrying: unpack requires a buffer of 4 bytes
DEBUG:kasa.protocol:> (249) {"system": {"get_sysinfo": null}, "emeter": {"get_realtime": null}, "smartlife.iot.dimmer": {"get_dimmer_parameters": null}, "smartlife.iot.common.emeter": {"get_realtime": null}, "smartlife.iot.smartbulb.lightingservice": {"get_light_state": null}}
DEBUG:kasa.protocol:Giving up after 3 retries
Traceback (most recent call last):
File "/home/derek/.venvs/python-kasa/lib/python3.7/site-packages/kasa/protocol.py", line 64, in query
length = struct.unpack(">I", chunk[0:4])[0]
struct.error: unpack requires a buffer of 4 bytes
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/derek/.venvs/python-kasa/bin/kasa", line 11, in <module>
sys.exit(cli())
File "/home/derek/.venvs/python-kasa/lib/python3.7/site-packages/asyncclick/core.py", line 862, in __call__
return anyio.run(self._main, main, args, kwargs, **({"backend":_anyio_backend} if _anyio_backend is not None else {}))
File "/home/derek/.venvs/python-kasa/lib/python3.7/site-packages/anyio/_core/_eventloop.py", line 52, in run
return asynclib.run(func, *args, **backend_options) # type: ignore
File "/home/derek/.venvs/python-kasa/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 160, in run
return native_run(wrapper(), debug=debug)
File "/usr/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.7/asyncio/base_events.py", line 579, in run_until_complete
return future.result()
File "/home/derek/.venvs/python-kasa/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 155, in wrapper
return await func(*args)
File "/home/derek/.venvs/python-kasa/lib/python3.7/site-packages/asyncclick/core.py", line 865, in _main
return await main(*args, **kwargs)
File "/home/derek/.venvs/python-kasa/lib/python3.7/site-packages/asyncclick/core.py", line 814, in main
rv = await self.invoke(ctx)
File "/home/derek/.venvs/python-kasa/lib/python3.7/site-packages/asyncclick/core.py", line 1272, in invoke
return await Command.invoke(self, ctx)
File "/home/derek/.venvs/python-kasa/lib/python3.7/site-packages/asyncclick/core.py", line 1102, in invoke
return await ctx.invoke(self.callback, **ctx.params)
File "/home/derek/.venvs/python-kasa/lib/python3.7/site-packages/asyncclick/core.py", line 644, in invoke
rv = await rv
File "/home/derek/.venvs/python-kasa/lib/python3.7/site-packages/kasa/cli.py", line 77, in cli
dev = await Discover.discover_single(host)
File "/home/derek/.venvs/python-kasa/lib/python3.7/site-packages/kasa/discover.py", line 207, in discover_single
info = await protocol.query(host, Discover.DISCOVERY_QUERY)
File "/home/derek/.venvs/python-kasa/lib/python3.7/site-packages/kasa/protocol.py", line 80, in query
) from ex
kasa.exceptions.SmartDeviceException: Unable to query the device: unpack requires a buffer of 4 bytes
Trying to query the plug using tplink_smartplug.py using the full query string hangs and eventually returns nothing:
(python-kasa) derek@ubuntu:~$ time python ./tplink_smartplug.py -t 192.168.45.175 -j '{"system": {"get_sysinfo": null}, "emeter": {"get_realtime": null}, "smartlife.iot.dimmer": {"get_dimmer_parameters": null}, "smartlife.iot.common.emeter": {"get_realtime": null}, "smartlife.iot.smartbulb.lightingservice": {"get_light_state": null}}'
Sent: {"system": {"get_sysinfo": null}, "emeter": {"get_realtime": null}, "smartlife.iot.dimmer": {"get_dimmer_parameters": null}, "smartlife.iot.common.emeter": {"get_realtime": null}, "smartlife.iot.smartbulb.lightingservice": {"get_light_state": null}}
Received:
real 1m0.140s
user 0m0.043s
sys 0m0.005s
If the query string is broken up into individual pieces they all complete successfully however:
(python-kasa) derek@ubuntu:~$ python ./tplink_smartplug.py -t 192.168.45.175 -j '{"system": {"get_sysinfo": null}}'
Sent: {"system": {"get_sysinfo": null}}
Received: {"system":{"get_sysinfo":{"sw_ver":"1.0.2 Build 200819 Rel.103733","hw_ver":"5.0","model":"HS105(US)","deviceId":"800653EB6B8D49416C3A8CABFA7D27E71D8F7F58","oemId":"A3BE45A15350D76F11728AC99180D5E8","hwId":"6EEF0BBCE1D91460D5F5201C65C8A549","rssi":-53,"latitude_i":29xxxx,"longitude_i":-98xxxx,"alias":"Office Lamp","status":"new","obd_src":"tplink","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM","mac":"84:D8:1B:F4:EB:D7","updating":0,"led_off":0,"relay_state":1,"on_time":316,"icon_hash":"","dev_name":"Smart Wi-Fi Plug Mini","active_mode":"none","next_action":{"type":-1},"err_code":0}}}
(python-kasa) derek@ubuntu:~$ python ./tplink_smartplug.py -t 192.168.45.175 -j '{"emeter": {"get_realtime": null}}'
Sent: {"emeter": {"get_realtime": null}}
Received: {"emeter":{"err_code":-1,"err_msg":"module not support"}}
(python-kasa) derek@ubuntu:~$ python ./tplink_smartplug.py -t 192.168.45.175 -j '{"smartlife.iot.dimmer": {"get_dimmer_parameters": null}}'
Sent: {"smartlife.iot.dimmer": {"get_dimmer_parameters": null}}
Received: {"smartlife.iot.dimmer":{"err_code":-1,"err_msg":"module not support"}}
(python-kasa) derek@ubuntu:~$ python ./tplink_smartplug.py -t 192.168.45.175 -j '{"smartlife.iot.common.emeter": {"get_realtime": null}}'
Sent: {"smartlife.iot.common.emeter": {"get_realtime": null}}
Received: {"smartlife.iot.common.emeter":{"err_code":-1,"err_msg":"module not support"}}
(python-kasa) derek@ubuntu:~$ python ./tplink_smartplug.py -t 192.168.45.175 -j '{"smartlife.iot.smartbulb.lightingservice": {"get_light_state": null}}'
Sent: {"smartlife.iot.smartbulb.lightingservice": {"get_light_state": null}}
Received: {"smartlife.iot.smartbulb.lightingservice":{"err_code":-1,"err_msg":"module not support"}}
Metadata
Metadata
Assignees
Labels
No labels