rytilahti/python-yeelightbt

Cannot import name 'SymmetricMapping'

Closed this issue · 14 comments

2018-03-09 14:57:14 ERROR (Thread-19) [custom_components.light.yeelight_bt] Got exception: cannot import name 'SymmetricMapping'
2018-03-09 14:57:14 INFO (MainThread) [homeassistant.core] Bus:Handling <Event system_log_event[L]: source=custom_components/light/yeelight_bt.py, exception=, level=ERROR, timestamp=1520607434.851715, message=Got exception: cannot import name 'SymmetricMapping'>

I can‘t find the SymmetricMapping by anyway,I'm crazy

I have the same error.
Is it because of construct 2.9.37 ? (which is upgraded if you do an upgrade from git)

I have installed the 2.9.25 Should i upgrade ?

#17

this should explain why.

what i did is just call
pip install construct==2.9.25

which is downgrade to 2.9.25

it work on my first time run hass --open-ui
then the second time i run
it error again

Construct is now pinned at 2.9.41 on home assistant.

But yeelightbt is still showing the same error.
(And the code from the Pull Request 16 is not working either)
Anyone could point us in the right direction ?

I have the same issue

Any chance to solve this issue in the near future?

Same for me. Even if you downgrade if you're using home assistant this will break other components.

In some recent Construct version, SymmetricMapping was renamed to Mapping. This error is caused by using an outdated version.

The fix is being worked in #19, but it's a bit slow process as I'm busy with other things currently. If someone wants to step up and finish that porting, it'd be more than welcome.

hey,
did make commande
pip install construct==2.9.25
but still have error
pi@raspberrypi:~ $ yeelightbt scan
Traceback (most recent call last):
File "/usr/local/bin/yeelightbt", line 11, in
load_entry_point('python-yeelightbt==0.0.3.1', 'console_scripts', 'yeelightbt')()
File "/home/pi/.local/lib/python3.5/site-packages/pkg_resources/init.py", line 484, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/pi/.local/lib/python3.5/site-packages/pkg_resources/init.py", line 2725, in load_entry_point
return ep.load()
File "/home/pi/.local/lib/python3.5/site-packages/pkg_resources/init.py", line 2343, in load
return self.resolve()
File "/home/pi/.local/lib/python3.5/site-packages/pkg_resources/init.py", line 2349, in resolve
module = import(self.module_name, fromlist=['name'], level=0)
File "/home/pi/.local/lib/python3.5/site-packages/yeelightbt/init.py", line 2, in
from .lamp import Lamp
File "/home/pi/.local/lib/python3.5/site-packages/yeelightbt/lamp.py", line 7, in
from .structures import Request, Response, StateResult
File "/home/pi/.local/lib/python3.5/site-packages/yeelightbt/structures.py", line 4, in
from construct import (Struct, Int8ub, Int16ub, Const, Padded, Byte, Enum, Bytes, If, FlagsEnum,
ImportError: cannot import name 'SymmetricMapping'

thanks

I have the same problem, i've installed the plugin with custom deps deployment (i'm running Hassio with HA 0.87.0) but i can't make the light available...

Hi,
It seems to be a good script to control Candela but I'm facing the same issue 'ImportError: cannot import name 'SymmetricMapping' when trying to install it.
Is there a way to workarround ?
Thanks

So I just merged the changes and the code is where I left it long time ago. The basic functionality should work by using the command line tool for what it's worth, maybe someone finds this useful and creates PRs to fix other issues (esp. the homeassistant parts require work to make it usable), I have no personal interest on working further on this.