HA restart reverts changes / creation of a virtual device

Hi,

I have the problem, that I want create a new device inside a custom integration (better thermostat) but there is no functionality and a HA restart deletes this new device every time. I checked several options and potential mistakes, but configuration is identical to those devices already existing. Since there is also no issue or similar problem inside the custom integration repository, I’m pretty sure it’s a system-problem. When I create this new device, I also get a direct Error in the logs that appear to adress a problem in python or saving in general:

Logger: homeassistant
Quelle: config_entries.py:658
Erstmals aufgetreten: 16:36:27 (1 Vorkommnis)
Zuletzt protokolliert: 16:36:27

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/json.py", line 55, in json_encoder_default
    raise TypeError
TypeError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/storage.py", line 515, in _async_callback_delayed_write
    await self._async_handle_write_data()
  File "/usr/src/homeassistant/homeassistant/helpers/storage.py", line 540, in _async_handle_write_data
    await self._async_write_data(self.path, data)
  File "/usr/src/homeassistant/homeassistant/helpers/storage.py", line 545, in _async_write_data
    await self.hass.async_add_executor_job(self._write_data, self.path, data)
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/storage.py", line 552, in _write_data
    data["data"] = data.pop("data_func")()
                   ~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2703, in _data_to_save
    "entries": [entry.as_storage_fragment for entry in self._entries.values()]  # type: ignore[misc]
                ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "src/propcache/_helpers_c.pyx", line 82, in propcache._helpers_c.cached_property.__get__
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 658, in as_storage_fragment
    return json_fragment(json_bytes_sorted(self.as_dict()))
                         ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
TypeError: Type is not JSON serializable: module

Unfortunately I have very little knowledge of what is written there. Can somebody explain it or help me out with a hint?
Thank you very much!

system: newest versions, OS installation on raspi4 with external SSD-Harddrive