Closed apoxhu closed 1 year ago
Thanks for the good repot! I can partially reproduce this when running the code locally, not within HA.
The Docker image which I use for testing of HA 2023.3.6 uses Python version 3.10.10, which doesn't seem to have this issue.
Let me work on a fix, give me a sec. :)
@apoxhu I've released version v0.1.3 to fix this. Can you check it out and report back please?
Sure thanks for the quick fix, but still getting similar error, now for field "Port"
Logger: homeassistant.loader
Source: custom_components/artnet_led/client/artnet_server.py:68
Integration: artnet_led ([documentation](https://github.com/Breina/ha-artnet-led), [issues](https://github.com/Breina/ha-artnet-led/issues))
First occurred: 3:02:45 PM (2 occurrences)
Last logged: 3:02:58 PM
Unexpected exception importing platform custom_components.artnet_led.light
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/homeassistant/loader.py", line 779, in get_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/homeassistant/loader.py", line 796, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/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 "/data/data/com.termux/files/home/.homeassistant/custom_components/artnet_led/light.py", line 40, in <module>
from custom_components.artnet_led.bridge.artnet_controller import ArtNetController
File "/data/data/com.termux/files/home/.homeassistant/custom_components/artnet_led/bridge/artnet_controller.py", line 12, in <module>
from custom_components.artnet_led.client.artnet_server import ArtNetServer
File "/data/data/com.termux/files/home/.homeassistant/custom_components/artnet_led/client/artnet_server.py", line 68, in <module>
@dataclass
^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/dataclasses.py", line 1220, in dataclass
return wrap(cls)
^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/dataclasses.py", line 1210, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/dataclasses.py", line 958, in _process_class
cls_fields.append(_get_field(cls, name, type, kw_only))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/dataclasses.py", line 815, in _get_field
raise ValueError(f'mutable default {type(f.default)} for field '
ValueError: mutable default <class 'custom_components.artnet_led.client.Port'> for field port is not allowed: use default_factory
Ah sorry for not catching that! Can you try v0.1.4 please, pretty sure this should cover all of the cases.
Awesome! It works now! Thank you!
Hey
Getting exception using Home Assistant 2023.3.6 (core) edit: using Python 3.11.2 (main, Feb 11 2023, 14:06:23)
My config is