Skip to content

get_supervisor_info will no longer return addons soon #104

@mdegat01

Description

@mdegat01

Wanted to give you a heads up about a breaking change coming soon that we detected will affect you. In supervisor the addons field returned from a call to supervisor's /supervisor/info API has been deprecated for a while. As a result supervisor's client library aiohasupervisor does not support it. I've been slowly migrating core to use the client library for all interactions with supervisor and get rid of deprecated things like that.

So when home-assistant/core#164413 goes in (probably in a month, we're not going to put it in the march release) this code will break:

def get_ha_installed_addons(hass: HomeAssistant) -> list[dict[str, Any]]:
if not is_hassio(hass):
return []
supervisor_info = get_supervisor_info(hass)
if supervisor_info:
return supervisor_info.get("addons", [])
return []

Because the dictionary from get_supervisor_info will no longer include the addons fields.

Fortunately there's a simple alternative. homeassistant.components.hassio.get_addons_info returns all the same info as a dictionary keyed by addon slug. It's also available now in the current stable release so the following code is equivalent, works now and will keep working after the referenced PR goes in:

@callback
def get_ha_installed_addons(hass: HomeAssistant) -> list[dict[str, Any]]:
    if not is_hassio(hass):
        return []
    addons_info = get_addons_info(hass)

    if addons_info:
        return list(addons_info.values())
    return []

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions