azogue / aiopvpc

Simple aio library to download Spanish electricity hourly prices (PVPC) from esios.ree.es
MIT License
41 stars 10 forks source link

Detected code that uses str for device registry entry_type #42

Closed McGiverGim closed 1 year ago

McGiverGim commented 2 years ago

I think this error is produced by your integration. I see just three errors before loading each of the three sensors:

2022-01-10 10:37:58 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)
2022-01-10 10:37:58 WARNING (MainThread) [custom_components.esios.sensor] Setup of ESIOS PVPC (sensor.pvpc_horario_dha) finished
2022-01-10 10:37:58 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)
2022-01-10 10:37:58 WARNING (MainThread) [custom_components.esios.sensor] Setup of ESIOS CO2 intensity (sensor.esios_co2_intensity) finished
2022-01-10 10:37:58 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)
2022-01-10 10:37:58 WARNING (MainThread) [custom_components.esios.sensor] Setup of ESIOS Grid CO2 free percentage (sensor.esios_grid_co2_free_percentage) finished
azogue commented 1 year ago

This issue is about the experimental esios custom component with API token, which has 0 support, sorry 😅

It's about the entry_type="service", in sensor.py, which should be entry_type=DeviceEntryType.SERVICE,

✨ The new version v4 deprecates the esios component. For beta-testing it, follow instructions in https://github.com/azogue/aiopvpc/pull/47#issuecomment-1376937590

Closing this one 👍