From 4a63b83caa9b728e4acf87f492f5e7cbfd5c88f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Sat, 26 Sep 2020 09:17:04 +0200 Subject: [PATCH] Add installation type to discovery endpoint (#40585) --- homeassistant/components/api/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/homeassistant/components/api/__init__.py b/homeassistant/components/api/__init__.py index c1f692a76ad..34d899e996c 100644 --- a/homeassistant/components/api/__init__.py +++ b/homeassistant/components/api/__init__.py @@ -38,6 +38,7 @@ from homeassistant.helpers.json import JSONEncoder from homeassistant.helpers.network import NoURLAvailableError, get_url from homeassistant.helpers.service import async_get_all_descriptions from homeassistant.helpers.state import AsyncTrackStates +from homeassistant.helpers.system_info import async_get_system_info _LOGGER = logging.getLogger(__name__) @@ -45,6 +46,7 @@ ATTR_BASE_URL = "base_url" ATTR_EXTERNAL_URL = "external_url" ATTR_INTERNAL_URL = "internal_url" ATTR_LOCATION_NAME = "location_name" +ATTR_INSTALLATION_TYPE = "installation_type" ATTR_REQUIRES_API_PASSWORD = "requires_api_password" ATTR_UUID = "uuid" ATTR_VERSION = "version" @@ -181,6 +183,7 @@ class APIDiscoveryView(HomeAssistantView): """Get discovery information.""" hass = request.app["hass"] uuid = await hass.helpers.instance_id.async_get() + system_info = await async_get_system_info(hass) data = { ATTR_UUID: uuid, @@ -188,6 +191,7 @@ class APIDiscoveryView(HomeAssistantView): ATTR_EXTERNAL_URL: None, ATTR_INTERNAL_URL: None, ATTR_LOCATION_NAME: hass.config.location_name, + ATTR_INSTALLATION_TYPE: system_info[ATTR_INSTALLATION_TYPE], # always needs authentication ATTR_REQUIRES_API_PASSWORD: True, ATTR_VERSION: __version__,