home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
74.01k stars 31.05k forks source link

apple_tv startup error - 'AppleTVConfigFlow' object has no attribute 'all_identifiers' #131697

Open sdb9696 opened 14 hours ago

sdb9696 commented 14 hours ago

The problem

Whenever apple_tv integration starts up it raises an error. I'm fairly sure it's caused by https://github.com/home-assistant/core/pull/126804.

This is happening in my prod environment (core 2024.11.2) and dev environment (core also).

It looks like the solution could be as simple as initialising the all_identifiers = set() but as I know nothing about this integration I thought better to raise an issue than go straight to a PR. @emontnemery do you have a view?

What version of Home Assistant Core has the issue?

core-2024.11.2

What was the last working version of Home Assistant Core?

A couple of months ago

What type of installation are you running?

Home Assistant Core

Integration causing the issue

apple_tv

Link to integration documentation on our website

https://www.home-assistant.io/integrations/apple_tv/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2024-11-27 09:12:25.759 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None):   File "/usr/local/lib/python3.12/runpy.py", line 198, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.12/runpy.py", line 88, in _run_code
    exec(code, run_globals)
  File "/home/foobar/.vscode-server/extensions/ms-python.debugpy-2024.12.0/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 71, in <module>
    cli.main()
  File "/home/foobar/.vscode-server/extensions/ms-python.debugpy-2024.12.0/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 501, in main
    run()
  File "/home/foobar/.vscode-server/extensions/ms-python.debugpy-2024.12.0/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 384, in run_module
    run_module_as_main(options.target, alter_argv=True)
  File "/home/foobar/.vscode-server/extensions/ms-python.debugpy-2024.12.0/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 228, in _run_module_as_main
    return _run_code(code, main_globals, None, "__main__", mod_spec)
  File "/home/foobar/.vscode-server/extensions/ms-python.debugpy-2024.12.0/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 118, in _run_code
    exec(code, run_globals)
  File "/home/foobar/Code/barfoo/core/homeassistant/__main__.py", line 227, in <module>
    sys.exit(main())
  File "/home/foobar/Code/barfoo/core/homeassistant/__main__.py", line 213, in main
    exit_code = runner.run(runtime_conf)
  File "/home/foobar/Code/barfoo/core/homeassistant/runner.py", line 154, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1979, in _run_once
    handle._run()
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/foobar/Code/barfoo/core/homeassistant/runner.py", line 130, in setup_and_run_hass
    return await hass.async_run()
  File "/home/foobar/Code/barfoo/core/homeassistant/core.py", line 534, in async_run
    await self.async_start()
  File "/home/foobar/Code/barfoo/core/homeassistant/core.py", line 587, in async_start
    self.bus.async_fire_internal(EVENT_HOMEASSISTANT_STARTED)
  File "/home/foobar/Code/barfoo/core/homeassistant/core.py", line 1587, in async_fire_internal
    self._hass.async_run_hass_job(job, event)
  File "/home/foobar/Code/barfoo/core/homeassistant/core.py", line 949, in async_run_hass_job
    hassjob.target(*args)
  File "/home/foobar/Code/barfoo/core/homeassistant/core.py", line 1448, in __call__
    self.hass.async_run_hass_job(self.listener_job, event)
  File "/home/foobar/Code/barfoo/core/homeassistant/core.py", line 952, in async_run_hass_job
    return self._async_add_hass_job(hassjob, *args, background=background)
  File "/home/foobar/Code/barfoo/core/homeassistant/core.py", line 767, in _async_add_hass_job
    task = create_eager_task(
  File "/home/foobar/Code/barfoo/core/homeassistant/util/async_.py", line 45, in create_eager_task
    return Task(coro, loop=loop, name=name, eager_start=True)
Traceback (most recent call last):
  File "/home/foobar/Code/barfoo/core/homeassistant/helpers/discovery_flow.py", line 137, in _async_start
    await gather_with_limited_concurrency(FLOW_INIT_LIMIT, *init_coros)
  File "/home/foobar/Code/barfoo/core/homeassistant/util/async_.py", line 114, in gather_with_limited_concurrency
    return await gather(
           ^^^^^^^^^^^^^
  File "/home/foobar/Code/barfoo/core/homeassistant/util/async_.py", line 112, in sem_task
    return await task
           ^^^^^^^^^^
  File "/home/foobar/Code/barfoo/core/homeassistant/config_entries.py", line 1315, in async_init
    flow, result = await self._async_init(flow_id, handler, context, data)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/foobar/Code/barfoo/core/homeassistant/config_entries.py", line 1350, in _async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/foobar/Code/barfoo/core/homeassistant/data_entry_flow.py", line 517, in _async_handle_step
    result: _FlowResultT = await getattr(flow, method)(user_input)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/foobar/Code/barfoo/core/homeassistant/components/apple_tv/config_flow.py", line 237, in async_step_zeroconf
    await self._async_aggregate_discoveries(host, unique_id)
  File "/home/foobar/Code/barfoo/core/homeassistant/components/apple_tv/config_flow.py", line 279, in _async_aggregate_discoveries
    self._async_check_and_update_in_progress(host, unique_id)
  File "/home/foobar/Code/barfoo/core/homeassistant/components/apple_tv/config_flow.py", line 287, in _async_check_and_update_in_progress
    if self.hass.config_entries.flow.async_has_matching_flow(self):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/foobar/Code/barfoo/core/homeassistant/config_entries.py", line 1609, in async_has_matching_flow
    if other_flow is not flow and flow.is_matching(other_flow):  # type: ignore[arg-type]
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/foobar/Code/barfoo/core/homeassistant/components/apple_tv/config_flow.py", line 299, in is_matching
    other_flow.all_identifiers.add(self.unique_id)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'AppleTVConfigFlow' object has no attribute 'all_identifiers'. Did you mean: 'atv_identifiers'?


### Additional information

_No response_
home-assistant[bot] commented 14 hours ago

Hey there @postlund, mind taking a look at this issue as it has been labeled with an integration (apple_tv) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `apple_tv` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign apple_tv` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


apple_tv documentation apple_tv source (message by IssueLinks)