core: Tuya Lights not working with 2023.3.0 and Python 3.11
The problem
With version 2023.3.0 I can use Home-Assistant Core with Python 3.11. In my case the only issue was Tuya integration that report error with homeassistant.components.tuya.light. It doesn’t works.
Other Tuya devices (plug, remote control, etc) works well to me
What version of Home Assistant Core has the issue?
core-2023.3.0
What was the last working version of Home Assistant Core?
core-2023.2.5
What type of installation are you running?
Home Assistant Core
Integration causing the issue
Tuya
Link to integration documentation on our website
https://www.home-assistant.io/integrations/tuya
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
2023-03-01 18:43:53.599 ERROR (MainThread) [homeassistant.loader] Unexpected exception importing platform homeassistant.components.tuya.light
Traceback (most recent call last):
File "/opt/homeassistant/lib64/python3.11/site-packages/homeassistant/loader.py", line 779, in get_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homeassistant/lib64/python3.11/site-packages/homeassistant/loader.py", line 796, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/opt/homeassistant/lib64/python3.11/site-packages/homeassistant/components/tuya/light.py", line 52, in <module>
@dataclass
^^^^^^^^^
File "/usr/lib64/python3.11/dataclasses.py", line 1220, in dataclass
return wrap(cls)
^^^^^^^^^
File "/usr/lib64/python3.11/dataclasses.py", line 1210, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/dataclasses.py", line 958, in _process_class
cls_fields.append(_get_field(cls, name, type, kw_only))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/dataclasses.py", line 815, in _get_field
raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'homeassistant.components.tuya.light.ColorTypeData'> for field default_color_type is not allowed: use default_factory
2023-03-01 18:43:53.611 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform tuya.light: Platform not found (Exception importing homeassistant.components.tuya.light).
Additional information
It works fine with 2023.2.5 and Python 3.10
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 4
- Comments: 23 (3 by maintainers)
Again, as responded above as well, if you run HA OS, this issue is not related to your environment and does not apply to your situation. You don’t have this issue reported here. You are in the wrong place.
…/Frenck
Am using latest HA Core 2023.3.2 and Python 3.11.2 so I suggest you upgrade your Python version?