I have installed this on several machines, and all of them seem to be returning the same error when scanning for devices:
No host name given, trying discovery..
Discovering devices on 255.255.255.255 for 3 seconds
== Living Room Floor Lamp - HS110(US) ==
Host: 192.168.88.187
Device state: ON
== Generic information ==
Time: 2022-01-31 17:14:11
Hardware: 1.0
Software: 1.2.6 Build 200727 Rel.121701
MAC (rssi): 50:C7:BF:4D:44:DF (-48)
Location: {'latitude': 29.931202, 'longitude': -95.263188}
== Device specific information ==
LED state: True
On since: 2022-01-31 22:54:54.048137
== Current State ==
Traceback (most recent call last):
File "/usr/local/bin/kasa", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.9/dist-packages/asyncclick/core.py", line 1150, in __call__
return anyio.run(self._main, main, args, kwargs, **({"backend":_anyio_backend} if _anyio_backend is not None else {}))
File "/usr/local/lib/python3.9/dist-packages/anyio/_core/_eventloop.py", line 56, in run
return asynclib.run(func, *args, **backend_options)
File "/usr/local/lib/python3.9/dist-packages/anyio/_backends/_asyncio.py", line 233, in run
return native_run(wrapper(), debug=debug)
File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/usr/local/lib/python3.9/dist-packages/anyio/_backends/_asyncio.py", line 228, in wrapper
return await func(*args)
File "/usr/local/lib/python3.9/dist-packages/asyncclick/core.py", line 1153, in _main
return await main(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/asyncclick/core.py", line 1074, in main
rv = await self.invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/asyncclick/core.py", line 1662, in invoke
await super().invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/asyncclick/core.py", line 1420, in invoke
return await ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/dist-packages/asyncclick/core.py", line 774, in invoke
rv = await rv
File "/usr/local/lib/python3.9/dist-packages/kasa/cli.py", line 82, in cli
await ctx.invoke(discover)
File "/usr/local/lib/python3.9/dist-packages/asyncclick/core.py", line 774, in invoke
rv = await rv
File "/usr/local/lib/python3.9/dist-packages/kasa/cli.py", line 162, in discover
await ctx.invoke(state)
File "/usr/local/lib/python3.9/dist-packages/asyncclick/core.py", line 774, in invoke
rv = await rv
File "/usr/local/lib/python3.9/dist-packages/asyncclick/core.py", line 774, in invoke
rv = await rv
File "/usr/local/lib/python3.9/dist-packages/kasa/cli.py", line 231, in state
emeter_status = dev.emeter_realtime
File "/usr/local/lib/python3.9/dist-packages/kasa/smartdevice.py", line 87, in wrapped
return f(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/kasa/smartdevice.py", line 432, in emeter_realtime
return EmeterStatus(self._last_update[self.emeter_type]["get_realtime"])
KeyError: 'emeter'
It does partially return the information for one device and if I directly specify that device I can turn it on / off. Does not seem to matter if I run it under my name or root. Package installed with pip on all machines.
This is a regression caused by #132. I'll create a patch to the cli tool to perform a full update, but the emeter accesses should likely be guarded by a check to raise an exception if the information is not available.
Activity
LitBomb commented on Jan 31, 2022
Are you on Windows? I see this on as well when I run kasa discover. I reported this in issue 294 https://github.com/python-kasa/python-kasa/issues/294
greg713 commented on Jan 31, 2022
Error is from a Debian 11 VM, but have also tried it on Ubuntu 21 and WSL. Same error.
LitBomb commented on Jan 31, 2022
Great. Good to know this is not Windows-specific. Thanks.
apassemard commented on Feb 1, 2022
Getting the same error on Mac just now.
Python 2.7.18
on Monterey
rytilahti commented on Feb 2, 2022
This is a regression caused by #132. I'll create a patch to the cli tool to perform a full update, but the emeter accesses should likely be guarded by a check to raise an exception if the information is not available.
Release 0.4.2
Release 0.4.2 (#321)
Release 0.4.2 (python-kasa#321)