Mobile App: Update Location schema updates & device ID generation (#21849)
* Update location schema * Generate a random device ID at registration time for later use with device_tracker.see * Remove host name from device_tracker.see payload * Drop consider_home from the payload * Remove stale consider_home in schema * Remove source_type
This commit is contained in:
parent
5ef602bc2e
commit
673c8907e3
3 changed files with 61 additions and 17 deletions
|
@ -1,4 +1,5 @@
|
|||
"""Provides an HTTP API for mobile_app."""
|
||||
import uuid
|
||||
from typing import Dict
|
||||
|
||||
from aiohttp.web import Response, Request
|
||||
|
@ -15,10 +16,11 @@ from homeassistant.helpers.storage import Store
|
|||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
from homeassistant.loader import get_component
|
||||
|
||||
from .const import (ATTR_APP_COMPONENT, ATTR_SUPPORTS_ENCRYPTION,
|
||||
CONF_CLOUDHOOK_URL, CONF_SECRET, CONF_USER_ID,
|
||||
DATA_REGISTRATIONS, DOMAIN, ERR_INVALID_COMPONENT,
|
||||
ERR_SAVE_FAILURE, REGISTRATION_SCHEMA)
|
||||
from .const import (ATTR_APP_COMPONENT, ATTR_DEVICE_ID,
|
||||
ATTR_SUPPORTS_ENCRYPTION, CONF_CLOUDHOOK_URL, CONF_SECRET,
|
||||
CONF_USER_ID, DATA_REGISTRATIONS, DOMAIN,
|
||||
ERR_INVALID_COMPONENT, ERR_SAVE_FAILURE,
|
||||
REGISTRATION_SCHEMA)
|
||||
|
||||
from .helpers import error_response, supports_encryption, savable_state
|
||||
|
||||
|
@ -66,6 +68,8 @@ class RegistrationsView(HomeAssistantView):
|
|||
data[CONF_CLOUDHOOK_URL] = \
|
||||
await async_create_cloudhook(hass, webhook_id)
|
||||
|
||||
data[ATTR_DEVICE_ID] = str(uuid.uuid4()).replace("-", "")
|
||||
|
||||
data[CONF_WEBHOOK_ID] = webhook_id
|
||||
|
||||
if data[ATTR_SUPPORTS_ENCRYPTION] and supports_encryption():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue