mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Get updated Assist satellite config after setting it in ESPHome (#126552)
Get updated config after setting it
This commit is contained in:
parent
fb45f4fcea
commit
4869309997
@ -174,6 +174,9 @@ class EsphomeAssistSatellite(
|
|||||||
)
|
)
|
||||||
_LOGGER.debug("Set active wake words: %s", config.active_wake_words)
|
_LOGGER.debug("Set active wake words: %s", config.active_wake_words)
|
||||||
|
|
||||||
|
# Ensure configuration is updated
|
||||||
|
await self._update_satellite_config()
|
||||||
|
|
||||||
async def _update_satellite_config(self) -> None:
|
async def _update_satellite_config(self) -> None:
|
||||||
"""Get the latest satellite configuration from the device."""
|
"""Get the latest satellite configuration from the device."""
|
||||||
config = await self.cli.get_voice_assistant_configuration(_CONFIG_TIMEOUT_SEC)
|
config = await self.cli.get_voice_assistant_configuration(_CONFIG_TIMEOUT_SEC)
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from collections.abc import Awaitable, Callable
|
from collections.abc import Awaitable, Callable
|
||||||
|
from dataclasses import replace
|
||||||
import io
|
import io
|
||||||
import socket
|
import socket
|
||||||
from unittest.mock import ANY, Mock, patch
|
from unittest.mock import ANY, Mock, patch
|
||||||
@ -1457,11 +1458,16 @@ async def test_get_set_configuration(
|
|||||||
actual_config = satellite.async_get_configuration()
|
actual_config = satellite.async_get_configuration()
|
||||||
assert actual_config == expected_config
|
assert actual_config == expected_config
|
||||||
|
|
||||||
# Change active wake words
|
updated_config = replace(actual_config, active_wake_words=["5678"])
|
||||||
actual_config.active_wake_words = ["5678"]
|
mock_client.get_voice_assistant_configuration.return_value = updated_config
|
||||||
await satellite.async_set_configuration(actual_config)
|
|
||||||
|
|
||||||
# Device should have been updated
|
# Change active wake words
|
||||||
|
await satellite.async_set_configuration(updated_config)
|
||||||
|
|
||||||
|
# Set config method should be called
|
||||||
mock_client.set_voice_assistant_configuration.assert_called_once_with(
|
mock_client.set_voice_assistant_configuration.assert_called_once_with(
|
||||||
active_wake_words=["5678"]
|
active_wake_words=["5678"]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Device should have been updated
|
||||||
|
assert satellite.async_get_configuration() == updated_config
|
||||||
|
Loading…
x
Reference in New Issue
Block a user