Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launch Library becomes unavailable often - does not restart #117142

Open
peyn opened this issue May 9, 2024 · 2 comments
Open

Launch Library becomes unavailable often - does not restart #117142

peyn opened this issue May 9, 2024 · 2 comments

Comments

@peyn
Copy link

peyn commented May 9, 2024

The problem

As mentioned here (#114094) the Launch Library often times out and has its sensors set to "Unavailable" state. All fine.
Except, the library seems to be very unstable - seems like the updates are at random times, especially if a timeout was met:
image

To add salt to injury, every time I reload the integration's config the data is read correctly. I even created an automation to do that.
It would be great if the data was retrieved at specific time interval (30 minutes?) and/or we could have a setting to change that interval.

What version of Home Assistant Core has the issue?

core-2024.5.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Launch Library

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Error description states:
Error fetching launch_library data: Timeout while fetching data from https://ll.thespacedevs.com/2.2.0/dashboard/starship/

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented May 9, 2024

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

Code owner commands

Code owners of launch_library 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 launch_library 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)


launch_library documentation
launch_library source
(message by IssueLinks)

@peyn
Copy link
Author

peyn commented May 11, 2024

Hi,

Some more information about the issue.

You can see in the image pasted below that Next Launch information quite often cannot read the data from Starship related API.
This affects not only the Starship related sensor, but all available from the Launch Library. However, right after the "Next Launch" sensor state is set to "Unavailable" my own automation kicks in which triggers yet another refresh of the state - which ends with a success.
image

This results in all sensors being updated:
image

The reason for that, in my opinion, is that the Starship api is hella slow... This is the Network > Timing from Chrome (on 1GB/1GB internet connection):
image

And no wonder, as far as I can see it reads all the information it has related to the Starship. Which is a lot - about 1,5 MB:
image

What surprises me is that, it_seems, there is no caching of the data returned by API, even though Starship events are so rare. The server puts together all this information every time the request is made - thus the long response time.

I looked into the code of Launch Library, but I don't really know Python and the Home Assistant is a quite complex project already, so I had no luck in finding anything.
My ideas at this point are:

  1. After the initial Starship refresh, if it fails, refresh it one more time
  2. Do not make all sensors "Unavailable" when Starship refresh fails, make only the ones related to Starship
  3. Change the Starship related data provider, e.g. https://nextspaceflight.com/starship/ - would require new additional logic for reading and/or parsing of the data. Maybe multiple providers with an option to select the one to be used?
  4. Add an option to disable the Starship information update.

Kind regards,
Mateusz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants