Skip to content

Commit

Permalink
Add model ID to unifiprotect (home-assistant#125376)
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob authored Sep 5, 2024
1 parent aa619c5 commit c3921f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion homeassistant/components/unifiprotect/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ def _async_set_device_info(self) -> None:
self._attr_device_info = DeviceInfo(
name=self.device.display_name,
manufacturer=DEFAULT_BRAND,
model=self.device.type,
model=self.device.market_name or self.device.type,
model_id=self.device.type,
via_device=(DOMAIN, self.data.api.bootstrap.nvr.mac),
sw_version=self.device.firmware_version,
connections={(dr.CONNECTION_NETWORK_MAC, self.device.mac)},
Expand Down
10 changes: 9 additions & 1 deletion tests/components/unifiprotect/test_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
Platform,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.setup import async_setup_component

from .utils import (
Expand Down Expand Up @@ -66,6 +66,14 @@ def validate_default_camera_entity(
assert entity.disabled is False
assert entity.unique_id == unique_id

device_registry = dr.async_get(hass)
device = device_registry.async_get(entity.device_id)
assert device
assert device.manufacturer == "Ubiquiti"
assert device.name == camera_obj.name
assert device.model == camera_obj.market_name or camera_obj.type
assert device.model_id == camera_obj.type

return entity_id


Expand Down

0 comments on commit c3921f2

Please sign in to comment.