GeezerVison is showing github.com — Individual commands do not work on discovered devices · Issue #71 · python-kasa/python-kasa
Individual commands do not work on discovered devices #71DescriptionNo host name given, trying discovery..
Discovering devices for 3 seconds
== hs100a - HS100(US) ==
Host: 192.168.10.127
Device state: ON
== Generic information ==
Time: 2020-06-11 17:13:12
Hardware: 2.0
Software: 1.5.6 Build 191118 Rel.140307
MAC (rssi): XX:XX:XX:XX:XX:XX (-48)
Location: {'latitude': 304306, 'longitude': -978273}
== Device specific information ==
LED state: True
On since: 2020-06-11 16:58:33.087466
Traceback (most recent call last):
File "/home/userx/tmp/python/venv8/bin/kasa", line 8, in <module>
sys.exit(cli())
File "/home/userx/tmp/python/venv8/lib/python3.8/site-packages/asyncclick/core.py", line 799, in __call__
return anyio.run(self._main, main, args, kwargs, backend=_anyio_backend)
File "/home/userx/tmp/python/venv8/lib/python3.8/site-packages/anyio/__init__.py", line 68, in run
return asynclib.run(func, *args, **backend_options) # type: ignore
File "/home/userx/tmp/python/venv8/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 99, in run
raise exception
File "/home/userx/tmp/python/venv8/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 67, in wrapper
retval = await func(*args)
File "/home/userx/tmp/python/venv8/lib/python3.8/site-packages/asyncclick/core.py", line 802, in _main
return await main(*args, **kwargs)
File "/home/userx/tmp/python/venv8/lib/python3.8/site-packages/asyncclick/core.py", line 748, in main
rv = await self.invoke(ctx)
File "/home/userx/tmp/python/venv8/lib/python3.8/site-packages/asyncclick/core.py", line 1175, in invoke
return await _process_result(await sub_ctx.command.invoke(sub_ctx))
File "/home/userx/tmp/python/venv8/lib/python3.8/site-packages/asyncclick/core.py", line 994, in invoke
return await ctx.invoke(self.callback, **ctx.params)
File "/home/userx/tmp/python/venv8/lib/python3.8/site-packages/asyncclick/core.py", line 586, in invoke
rv = callback(*args, **kwargs)
File "/home/userx/tmp/python/venv8/lib/python3.8/site-packages/asyncclick/decorators.py", line 60, in new_func
raise RuntimeError('Managed to invoke callback without a '
RuntimeError: Managed to invoke callback without a context object of type 'SmartDevice' existing
Activitylaoshaw commented on Jun 11, 2020 Actually, that happens to on and off too, I can get rid of the error with '--host IPAddr' however. Reacted by gpicc, Eric Winer, Julian Fessard and Alexis rytilahti commented on Jun 12, 2020 The problem is that the given command is run separately from the type discovery, so there is no "device" object created for that. There are two potential solutions:
- Stop propagating the command when no type is defined, or
- Pass the list of devices to the command, which need to handle each found instance separately.
I'm not sure what's the best approach here, but I'm leaning to the first one. changed the title [-]HS100 python 3.8 sysinfo error[/-] [+]Individual commands do not work on discovered devices[/+] on Nov 25, 2020bmbouter commented on Feb 4, 2021
The problem is that the given command is run separately from the type discovery, so there is no "device" object created for that. There are two potential solutions:
1. Stop propagating the command when no type is defined, or
2. Pass the list of devices to the command, which need to handle each found instance separately.
I'm not sure what's the best approach here, but I'm leaning to the first one.
Could you put some links into the relevant parts of the code for me to look at? rytilahti commented on Feb 7, 2021 DanielJoyce commented on Jun 13, 2021 So none of the on/off and other commands work? I'm using the master branch lyricnz commented on Aug 21, 2022 I have some error output, running "kasa emeter" from CLI. My first switch, which has power-monitoring, works fine. The second emits this error. Seems some check needs to be made for feature missing from device?
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|