mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-08 09:46:29 +00:00
Return only installed addons inside info call (#32)
This commit is contained in:
parent
4680ba6d0d
commit
aa9c300d7c
@ -141,13 +141,18 @@ class AddonsData(Config):
|
|||||||
return set(self._system_data.keys())
|
return set(self._system_data.keys())
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def list_all(self):
|
def data_all(self):
|
||||||
"""Return a list of all addons."""
|
"""Return a dict of all addons."""
|
||||||
return {
|
return {
|
||||||
**self._system_data,
|
**self._system_data,
|
||||||
**self._addons_cache
|
**self._addons_cache
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def data_installed(self):
|
||||||
|
"""Return a dict of installed addons."""
|
||||||
|
return self._system_data.copy()
|
||||||
|
|
||||||
def list_startup(self, start_type):
|
def list_startup(self, start_type):
|
||||||
"""Get list of installed addon with need start by type."""
|
"""Get list of installed addon with need start by type."""
|
||||||
addon_list = set()
|
addon_list = set()
|
||||||
|
@ -36,12 +36,17 @@ class APISupervisor(object):
|
|||||||
self.addons = addons
|
self.addons = addons
|
||||||
self.host_control = host_control
|
self.host_control = host_control
|
||||||
|
|
||||||
def _addons_list(self, only_installed):
|
def _addons_list(self, only_installed=False):
|
||||||
"""Return a list of addons."""
|
"""Return a list of addons."""
|
||||||
data = []
|
|
||||||
detached = self.addons.list_detached
|
detached = self.addons.list_detached
|
||||||
|
|
||||||
for addon, values in self.addons.list_all.items():
|
if only_installed:
|
||||||
|
addons = self.addons.data_installed
|
||||||
|
else:
|
||||||
|
addons = self.addons.data_all
|
||||||
|
|
||||||
|
data = []
|
||||||
|
for addon, values in addons:
|
||||||
i_version = self.addons.version_installed(addon)
|
i_version = self.addons.version_installed(addon)
|
||||||
|
|
||||||
data.append({
|
data.append({
|
||||||
@ -92,7 +97,7 @@ class APISupervisor(object):
|
|||||||
async def available_addons(self, request):
|
async def available_addons(self, request):
|
||||||
"""Return information for all available addons."""
|
"""Return information for all available addons."""
|
||||||
return {
|
return {
|
||||||
ATTR_ADDONS: self._addons_list(only_installed=False),
|
ATTR_ADDONS: self._addons_list(),
|
||||||
ATTR_REPOSITORIES: self._repositories_list(),
|
ATTR_REPOSITORIES: self._repositories_list(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user