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
71.66k stars 29.95k forks source link

Downloader not initializing #114829

Closed DarthSonic closed 5 months ago

DarthSonic commented 5 months ago

The problem

Downloader does not start/initialize.

What version of Home Assistant Core has the issue?

core-2024.4.0

What was the last working version of Home Assistant Core?

core-2023.3.6

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Downloader

Link to integration documentation on our website

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

Diagnostics information

Logger: homeassistant.bootstrap Quelle: setup.py:181 Erstmals aufgetreten: 10:29:47 (1 Vorkommnisse) Zuletzt protokolliert: 10:29:47

Error setting up integration downloader - received exception Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 166, in async_setup_component setup_future.set_result(result) asyncio.exceptions.InvalidStateError: invalid state

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 181, in async_setup_component future.set_exception(err) asyncio.exceptions.InvalidStateError: invalid state

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 5 months ago

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

Code owner commands Code owners of `downloader` 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 downloader` 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)


downloader documentation downloader source (message by IssueLinks)

CrouchingWorm commented 5 months ago

+1 Pls. I'm in the same boat.

billmaterial commented 5 months ago

Me too!!!

Jazza159 commented 5 months ago

+1 please. Same issue after updating to 2024.4. The downloader.download_file service doesn't seem to exist.

ydellis commented 5 months ago

The same for me.

andrewcliffoutlook commented 5 months ago

If you restart HA is does load and imports the yaml configuration entry as well as warn about the deprecation of the yaml version and to remove the enries from configuration.yaml

dannytsang commented 5 months ago

If you restart HA is does load and imports the yaml configuration entry as well as warn about the deprecation of the yaml version and to remove the enries from configuration.yaml

This worked for me. Thank you

AngeloAna commented 5 months ago

If you remove the configuration.yaml entries, where do you specify the network share to output the files?

dierochade commented 5 months ago

Can it be that it’s just the setup procedure that changed? In release notes is stated: ‚now available to set up from the UI’

I can’t verify on my own right now…

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

dannytsang commented 5 months ago

If you remove the configuration.yaml entries, where do you specify the network share to output the files?

It should go in the subdir parameter. Here's an example of what I have now:

      - service: downloader.download_file
        data:
          url: 'https://myimage.com/image.jpg'
          subdir: /config/camera
          filename: camera.jpg

I haven't tried it with a network share but it works when the file is stored on locally.

AngeloAna commented 5 months ago

I figured it out. I removed the configuration.yaml downlaoder: entry. I then deleted the integration. I rebooted HA. I then added the integration from the UI. It asked for the output location. I specified my share location. Everything seems to be working now.

DarthSonic commented 5 months ago

If you remove the "old" configuration form configuration.yaml, remove integration of "Downloader", then restart, you can add the integration "Downloader" and specify the download directory. Then you can run your automation script and everything should work.

jprates commented 5 months ago

As I mentioned here, it would be a great improvement if we could see what dir was set in that new downloader UI.

As it stands now on 2024.4 after we set the dir there is no way AFAIK to check/read the dir set in place.

I'd like to ask the developer(s) (@erwindouna ?) to please include it in the UI so that it gets visibility.

Cheers, -jprates

erwindouna commented 5 months ago

I am currently still investigating what could cause this - it's not very straight forward at the moment.

daernsinstantfortress commented 5 months ago

Thanks all - looks like a bug relating to the migration from YAML to UI configuration. As others have said, removing the YAML config and rebooting allows it to load. No need to remove the integration - it loaded just fine after the reboot.

bdraco commented 5 months ago

Please post the full log there is likely an exception that happened before asyncio.exceptions.InvalidStateError: invalid state that gets the setup into an invalid state that will need to be discovered to find the source of the issue

bdraco commented 5 months ago

We do usually do import flows in a task https://github.com/home-assistant/core/blob/e845d127339e3e01ce2485d09719c8149f312c4a/homeassistant/components/downloader/__init__.py#L46

It looks like the import flow does not abort on invalid dir https://github.com/home-assistant/core/blob/e845d127339e3e01ce2485d09719c8149f312c4a/homeassistant/components/downloader/config_flow.py#L35 and instead will present a form

bkbartk commented 5 months ago

Thanks all - looks like a bug relating to the migration from YAML to UI configuration. As others have said, removing the YAML config and rebooting allows it to load. No need to remove the integration - it loaded just fine after the reboot.

I tried without removing the integration, but that didn't work for me, so it might depend on a setting if this is needed or not.

but it's working now and that's the most important.

Jazza159 commented 5 months ago

Thanks, everyone! Removing the YAML config and rebooting has it working again!

erwindouna commented 5 months ago

Fixed provided in 2024.4.1.