Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions homeassistant/components/bosch_shc/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,7 @@ def __init__(self, device: SHCDevice, parent_id: str, entry_id: str) -> None:
manufacturer=device.manufacturer,
model=device.device_model,
name=device.name,
via_device=(
DOMAIN,
device.parent_device_id
if device.parent_device_id is not None
else parent_id,
),
via_device=(DOMAIN, device.root_device_id),
)
super().__init__(device=device, parent_id=parent_id, entry_id=entry_id)

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/togrill/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async def _connect_and_update_registry(self) -> Client:
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),
)

Expand Down
32 changes: 32 additions & 0 deletions tests/components/togrill/snapshots/test_init.ambr
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# serializer version: 1
# name: test_setup_device_present
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'config_entries_subentries': <ANY>,
'configuration_url': None,
'connections': set({
tuple(
'bluetooth',
'00000000-0000-0000-0000-000000000001',
),
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
}),
'labels': set({
}),
'manufacturer': None,
'model': None,
'model_id': 'Pro-05',
'name': 'Pro-05',
'name_by_user': None,
'primary_config_entry': <ANY>,
'serial_number': None,
'sw_version': '0.0',
'via_device_id': None,
})
# ---
7 changes: 7 additions & 0 deletions tests/components/togrill/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

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

Expand All @@ -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."""

Expand All @@ -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,
Expand Down
Loading