MCPcopy
hub / github.com/hacs/integration / async_load_hacs_from_github

Method async_load_hacs_from_github

custom_components/hacs/base.py:786–825  ·  view source on GitHub ↗

Load HACS from GitHub.

(self, _=None)

Source from the content-addressed store, hash-verified

784 self.enable_hacs_category(HacsCategory.APPDAEMON)
785
786 async def async_load_hacs_from_github(self, _=None) -> None:
787 """Load HACS from GitHub."""
788 if self.status.inital_fetch_done:
789 return
790
791 try:
792 repository = self.repositories.get_by_full_name(HacsGitHubRepo.INTEGRATION)
793 should_recreate_entities = False
794 if repository is None:
795 should_recreate_entities = True
796 await self.async_register_repository(
797 repository_full_name=HacsGitHubRepo.INTEGRATION,
798 category=HacsCategory.INTEGRATION,
799 default=True,
800 )
801 repository = self.repositories.get_by_full_name(HacsGitHubRepo.INTEGRATION)
802 elif not self.status.startup:
803 self.log.error("Scheduling update of hacs/integration")
804 self.queue.add(repository.common_update())
805 if repository is None:
806 raise HacsException("Unknown error")
807
808 repository.data.installed = True
809 repository.data.installed_version = self.integration.version.string
810 repository.data.new = False
811 repository.data.releases = True
812
813 if should_recreate_entities:
814 await self.async_recreate_entities()
815
816 self.repository = repository.repository_object
817 self.repositories.mark_default(repository)
818 except HacsException as exception:
819 if "403" in str(exception):
820 self.log.critical(
821 "GitHub API is ratelimited, or the token is wrong.",
822 )
823 else:
824 self.log.critical("Could not load HACS! - %s", exception)
825 self.disable_hacs(HacsDisabledReason.LOAD_HACS)
826
827 async def async_get_all_category_repositories(self, _=None) -> None:
828 """Get all category repositories."""

Callers 1

startup_tasksMethod · 0.95

Calls 8

disable_hacsMethod · 0.95
HacsExceptionClass · 0.85
get_by_full_nameMethod · 0.80
common_updateMethod · 0.80
mark_defaultMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected