mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 10:17:51 +00:00
Add installation type to discovery endpoint (#40585)
This commit is contained in:
parent
4cb118ca29
commit
4a63b83caa
@ -38,6 +38,7 @@ from homeassistant.helpers.json import JSONEncoder
|
|||||||
from homeassistant.helpers.network import NoURLAvailableError, get_url
|
from homeassistant.helpers.network import NoURLAvailableError, get_url
|
||||||
from homeassistant.helpers.service import async_get_all_descriptions
|
from homeassistant.helpers.service import async_get_all_descriptions
|
||||||
from homeassistant.helpers.state import AsyncTrackStates
|
from homeassistant.helpers.state import AsyncTrackStates
|
||||||
|
from homeassistant.helpers.system_info import async_get_system_info
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -45,6 +46,7 @@ ATTR_BASE_URL = "base_url"
|
|||||||
ATTR_EXTERNAL_URL = "external_url"
|
ATTR_EXTERNAL_URL = "external_url"
|
||||||
ATTR_INTERNAL_URL = "internal_url"
|
ATTR_INTERNAL_URL = "internal_url"
|
||||||
ATTR_LOCATION_NAME = "location_name"
|
ATTR_LOCATION_NAME = "location_name"
|
||||||
|
ATTR_INSTALLATION_TYPE = "installation_type"
|
||||||
ATTR_REQUIRES_API_PASSWORD = "requires_api_password"
|
ATTR_REQUIRES_API_PASSWORD = "requires_api_password"
|
||||||
ATTR_UUID = "uuid"
|
ATTR_UUID = "uuid"
|
||||||
ATTR_VERSION = "version"
|
ATTR_VERSION = "version"
|
||||||
@ -181,6 +183,7 @@ class APIDiscoveryView(HomeAssistantView):
|
|||||||
"""Get discovery information."""
|
"""Get discovery information."""
|
||||||
hass = request.app["hass"]
|
hass = request.app["hass"]
|
||||||
uuid = await hass.helpers.instance_id.async_get()
|
uuid = await hass.helpers.instance_id.async_get()
|
||||||
|
system_info = await async_get_system_info(hass)
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
ATTR_UUID: uuid,
|
ATTR_UUID: uuid,
|
||||||
@ -188,6 +191,7 @@ class APIDiscoveryView(HomeAssistantView):
|
|||||||
ATTR_EXTERNAL_URL: None,
|
ATTR_EXTERNAL_URL: None,
|
||||||
ATTR_INTERNAL_URL: None,
|
ATTR_INTERNAL_URL: None,
|
||||||
ATTR_LOCATION_NAME: hass.config.location_name,
|
ATTR_LOCATION_NAME: hass.config.location_name,
|
||||||
|
ATTR_INSTALLATION_TYPE: system_info[ATTR_INSTALLATION_TYPE],
|
||||||
# always needs authentication
|
# always needs authentication
|
||||||
ATTR_REQUIRES_API_PASSWORD: True,
|
ATTR_REQUIRES_API_PASSWORD: True,
|
||||||
ATTR_VERSION: __version__,
|
ATTR_VERSION: __version__,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user