File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 22
22
from homeassistant .setup import async_get_loaded_integrations
23
23
from jinja2 import Template
24
24
25
+
25
26
from .const import DOMAIN , DOMAIN_DATA , LOGGER , STARTUP_MESSAGE
26
27
27
28
CONFIG_SCHEMA = vol .Schema (
@@ -150,7 +151,7 @@ async def service_generate(_call):
150
151
await convert_lovelace (hass )
151
152
152
153
custom_components = await get_custom_integrations (hass )
153
- hacs_components = get_hacs_components ()
154
+ hacs_components = get_hacs_components (hass )
154
155
155
156
variables = {
156
157
"custom_components" : custom_components ,
@@ -170,21 +171,17 @@ async def service_generate(_call):
170
171
hass .services .async_register (DOMAIN , "generate" , service_generate )
171
172
172
173
173
- def get_hacs_components ():
174
- try :
175
- from custom_components .hacs .share import get_hacs
176
- except ImportError :
174
+ def get_hacs_components (hass : HomeAssistant ):
175
+ if (hacs := hass .data .get ("hacs" )) is None :
177
176
return []
178
177
179
- hacs = get_hacs ()
180
-
181
178
return [
182
179
{
183
180
** repo .data .to_json (),
184
181
"name" : get_repository_name (repo ),
185
182
"documentation" : f"https://github.com/{ repo .data .full_name } " ,
186
183
}
187
- for repo in hacs .repositories or [] if repo . data . installed
184
+ for repo in hacs .repositories . list_downloaded or []
188
185
]
189
186
190
187
Original file line number Diff line number Diff line change 5
5
"filename" : " readme.zip" ,
6
6
"homeassistant" : " 2021.5.0" ,
7
7
"hide_default_branch" : true ,
8
- "render_readme" : true
8
+ "render_readme" : true ,
9
+ "hacs" : " 0.19.1"
9
10
}
You can’t perform that action at this time.
0 commit comments