1
mirror of https://github.com/home-assistant/core synced 2024-08-02 23:40:32 +02:00

Allow None agent in conversation (#63761)

This commit is contained in:
epenet 2022-01-10 17:02:54 +01:00 committed by GitHub
parent eacd9f9994
commit 8fcca8c88b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -221,7 +221,7 @@ async def _configure_almond_for_ha(
await hass.auth.async_remove_refresh_token(token)
async def async_unload_entry(hass, entry):
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload Almond."""
conversation.async_set_agent(hass, None)
return True

View File

@ -1,4 +1,6 @@
"""Support for functionality to have conversations with Home Assistant."""
from __future__ import annotations
from http import HTTPStatus
import logging
import re
@ -48,7 +50,7 @@ async_register = bind_hass(async_register)
@core.callback
@bind_hass
def async_set_agent(hass: core.HomeAssistant, agent: AbstractConversationAgent):
def async_set_agent(hass: core.HomeAssistant, agent: AbstractConversationAgent | None):
"""Set the agent to handle the conversations."""
hass.data[DATA_AGENT] = agent