Detected code that uses str for device registry entry_type. This is deprecated and will stop working in Home Assistant 2022.3, it should be updated to use DeviceEntryType instead. Please report this issue

since updating to 2021.12.1 coming from 2021.11.5 , i have error below
How can i troubleshoot this? i have no idea where its coming from?

thnx in advance

2021-12-13 18:58:59 WARNING (MainThread) [homeassistant.helpers.frame] Detected code that uses str for device registry entry_type. This is deprecated and will stop working in Home Assistant 2022.3, it should be updated to use DeviceEntryType instead. Please report this issue.
Stack (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 331, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 318, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 121, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 629, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 596, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1890, in _run_once
    handle._run()
  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 500, in _async_add_entity
    device = device_registry.async_get_or_create(**processed_dev_info)  # type: ignore[arg-type]
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 360, in async_get_or_create
    report(  # type: ignore[unreachable]
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 74, in report
    _LOGGER.warning(msg, stack_info=True)
Stack (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 331, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 318, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 121, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 629, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 596, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1890, in _run_once
    handle._run()
  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 500, in _async_add_entity
    device = device_registry.async_get_or_create(**processed_dev_info)  # type: ignore[arg-type]
  File "/usr/src/homeassistant/homeassistant/helpers/device_registry.py", line 360, in async_get_or_create
    report(  # type: ignore[unreachable]
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 74, in report
    _LOGGER.warning(msg, stack_info=True)

hi @petro , sorry to poke you, but i saw you ow on discord channel (beta) talking about this, but cant reply there anymore

do you have any idea how i can troubleshoot this?

thnx in advance

nm, figured it out, i had a custom component for coinbase, where enum changes were not present yet

1 Like

How did you figure out what component caused it?

On luck, by looking on every custom one bye one

Ah, I have so many I was hoping there was an easy way to find out. Too bad the logs don’t specify

Yeah, indeed ,look at the specific Keyword, and use notepad++ to search in all files

What specific keyword do you mean? When I look at the raw logs I just see a lot of generic error messages leading up to this error

The word entry_type :slight_smile:

You need to look in the py files in your custom component folder, just do a search in the files

What did you use to search the files? When I use windows search it only pops up with one .js file that doesn’t even contain entry_type :man_shrugging:

With notepad++ you can search in files

Ah, you searched every file one by one? I have so many integrations, but ill just dig through them then :stuck_out_tongue:

I found out you can press ctrl+shift+F in VScode to search all files in a folder, and found the integrations that caused it!

Perfect, :slight_smile:

I have the same faultcode but the origin is HACS sow how to solve that?

class HACSDevice(Entity):

    """HACS Device class."""

    @property

    def device_info(self):

        """Return device information about HACS."""

        return {

            "identifiers": {(DOMAIN, self.unique_id)},

            "name": NAME_SHORT,

            "manufacturer": "hacs.xyz",

            "model": "",

            "sw_version": INTEGRATION_VERSION,

            "entry_type": "service",

        }'

Were you able to solve it. Just ran into the same problem… I tried to remove the apostrophes for “service”, but obviously this caused another error.

I haven’t been able to solve this error cause i don’t know how. I was hoping to get help here.

First import new DeviceEntryType:
from homeassistant.helpers.device_registry import DeviceEntryType
Then change
“entry_type” : “service”,
to
“entry_type” : DeviceEntryType.SERVICE,

No quarantee it will work with HACS, I used it for Fmi custom component.
And learn how to code Python, if you want to make changes. It helps.