From a3640c5664ffc4e1f93f4e51a93610dae6f79443 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Sun, 17 Aug 2025 06:30:05 +0200 Subject: [PATCH] feat: switch to model id for togrill (#150750) --- .../components/togrill/coordinator.py | 2 +- .../togrill/snapshots/test_init.ambr | 32 +++++++++++++++++++ tests/components/togrill/test_init.py | 7 ++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 tests/components/togrill/snapshots/test_init.ambr diff --git a/homeassistant/components/togrill/coordinator.py b/homeassistant/components/togrill/coordinator.py index b79e4350e1e..6aa06260178 100644 --- a/homeassistant/components/togrill/coordinator.py +++ b/homeassistant/components/togrill/coordinator.py @@ -100,7 +100,7 @@ class ToGrillCoordinator(DataUpdateCoordinator[dict[int, Packet]]): config_entry_id=config_entry.entry_id, connections={(CONNECTION_BLUETOOTH, self.address)}, name=config_entry.data[CONF_MODEL], - model=config_entry.data[CONF_MODEL], + model_id=config_entry.data[CONF_MODEL], sw_version=get_version_string(packet_a0), ) diff --git a/tests/components/togrill/snapshots/test_init.ambr b/tests/components/togrill/snapshots/test_init.ambr new file mode 100644 index 00000000000..b461d103e73 --- /dev/null +++ b/tests/components/togrill/snapshots/test_init.ambr @@ -0,0 +1,32 @@ +# serializer version: 1 +# name: test_setup_device_present + DeviceRegistryEntrySnapshot({ + 'area_id': None, + 'config_entries': , + 'config_entries_subentries': , + 'configuration_url': None, + 'connections': set({ + tuple( + 'bluetooth', + '00000000-0000-0000-0000-000000000001', + ), + }), + 'disabled_by': None, + 'entry_type': None, + 'hw_version': None, + 'id': , + 'identifiers': set({ + }), + 'labels': set({ + }), + 'manufacturer': None, + 'model': None, + 'model_id': 'Pro-05', + 'name': 'Pro-05', + 'name_by_user': None, + 'primary_config_entry': , + 'serial_number': None, + 'sw_version': '0.0', + 'via_device_id': None, + }) +# --- diff --git a/tests/components/togrill/test_init.py b/tests/components/togrill/test_init.py index 24f19ba367e..7f441817176 100644 --- a/tests/components/togrill/test_init.py +++ b/tests/components/togrill/test_init.py @@ -7,6 +7,7 @@ from syrupy.assertion import SnapshotAssertion from homeassistant.config_entries import ConfigEntryState from homeassistant.core import HomeAssistant +from homeassistant.helpers import device_registry as dr from . import TOGRILL_SERVICE_INFO, setup_entry @@ -20,6 +21,7 @@ async def test_setup_device_present( mock_entry: MockConfigEntry, mock_client: Mock, mock_client_class: Mock, + device_registry: dr.DeviceRegistry, ) -> None: """Test that setup works with device present.""" @@ -28,6 +30,11 @@ async def test_setup_device_present( await setup_entry(hass, mock_entry, []) assert mock_entry.state is ConfigEntryState.LOADED + device = device_registry.async_get_device( + connections={(dr.CONNECTION_BLUETOOTH, TOGRILL_SERVICE_INFO.address)} + ) + assert device == snapshot + async def test_setup_device_not_present( hass: HomeAssistant,