kubawolanin / ha-openhab

WORK IN PROGRESS 🏠 openHAB custom integration for Home Assistant
MIT License
15 stars 5 forks source link

Detected code that uses str for device registry entry_type. This is deprecated and will stop working in Home Assistant 2022.3 #23

Open airbone42 opened 1 year ago

airbone42 commented 1 year ago

Hi,

after activating the integration unfortunately there's a deprecation warning which spams the log files.

2022-11-15 11:19:50.563 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 Device$
Stack (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 203, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 191, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 119, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 633, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 600, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1896, in _run_once
    handle._run()
  File "/usr/local/lib/python3.10/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 573, 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 349, 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)
Crumpy1978 commented 1 year ago

It looks like this is a duplicate issue of #22

On my side the impact is that ha-openhab entities are refreshed only when ha-openhab is refreshed. i.e. : When I change de status of a switch in openhab (ON), it is not refreshed in home assistant =>it remains OFF until I manually refresh the ha-openhab.

In my situation it's a big deal because my house uses Nikobus (old version with a serial port) wich is only accessible through openhab. So my setup clearly depends on this wonderful piece of code here 💯

Unfortunately I am not a programmer :'(, or not yet lol )