From d3deae6288a2d2703f0824b184be1d1d07a227ae Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 11 Mar 2022 18:31:03 -1000 Subject: [PATCH] Fix typing on Context.user_id (#68019) --- homeassistant/components/google_assistant/smart_home.py | 1 + homeassistant/core.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/google_assistant/smart_home.py b/homeassistant/components/google_assistant/smart_home.py index f2aea247ecd..805c9100d9f 100644 --- a/homeassistant/components/google_assistant/smart_home.py +++ b/homeassistant/components/google_assistant/smart_home.py @@ -248,6 +248,7 @@ async def async_devices_disconnect(hass, data: RequestData, payload): https://developers.google.com/assistant/smarthome/develop/process-intents#DISCONNECT """ + assert data.context.user_id is not None await data.config.async_disconnect_agent_user(data.context.user_id) return None diff --git a/homeassistant/core.py b/homeassistant/core.py index 27dba3cbc52..8c662afce48 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -701,7 +701,7 @@ class HomeAssistant: class Context: """The context that triggered something.""" - user_id: str = attr.ib(default=None) + user_id: str | None = attr.ib(default=None) parent_id: str | None = attr.ib(default=None) id: str = attr.ib(factory=uuid_util.random_uuid_hex)