mirror of
https://github.com/home-assistant/core.git
synced 2026-09-27 01:46:11 -04:00
Add Lametric model (#181980)
This commit is contained in:
@@ -29,6 +29,7 @@ class LaMetricEntity(CoordinatorEntity[LaMetricDataUpdateCoordinator]):
|
||||
connections=connections,
|
||||
identifiers={(DOMAIN, coordinator.data.serial_number)},
|
||||
manufacturer="LaMetric Inc.",
|
||||
model=coordinator.data.model_name,
|
||||
model_id=coordinator.data.model,
|
||||
name=coordinator.data.name,
|
||||
sw_version=coordinator.data.os_version,
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
# serializer version: 1
|
||||
# name: test_device_info[device-SA110405124500W00BS9]
|
||||
DeviceRegistryEntrySnapshot({
|
||||
'area_id': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'configuration_url': 'https://127.0.0.1/',
|
||||
'connections': set({
|
||||
tuple(
|
||||
'bluetooth',
|
||||
'aa:bb:cc:dd:ee:ee',
|
||||
),
|
||||
tuple(
|
||||
'mac',
|
||||
'aa:bb:cc:dd:ee:ff',
|
||||
),
|
||||
}),
|
||||
'disabled_by': None,
|
||||
'entry_type': None,
|
||||
'hw_version': None,
|
||||
'id': <ANY>,
|
||||
'identifiers': set({
|
||||
tuple(
|
||||
'lametric',
|
||||
'SA110405124500W00BS9',
|
||||
),
|
||||
}),
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'LaMetric Inc.',
|
||||
'model': 'TIME',
|
||||
'model_id': 'LM 37X8',
|
||||
'name': "Frenck's LaMetric",
|
||||
'name_by_user': None,
|
||||
'serial_number': 'SA110405124500W00BS9',
|
||||
'sw_version': '2.2.2',
|
||||
'via_device_id': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_device_info[device_sa5-SA52100000123TBNC]
|
||||
DeviceRegistryEntrySnapshot({
|
||||
'area_id': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'configuration_url': 'https://127.0.0.1/',
|
||||
'connections': set({
|
||||
tuple(
|
||||
'bluetooth',
|
||||
'aa:bb:cc:dd:ee:ff',
|
||||
),
|
||||
tuple(
|
||||
'mac',
|
||||
'aa:bb:cc:dd:ee:ff',
|
||||
),
|
||||
}),
|
||||
'disabled_by': None,
|
||||
'entry_type': None,
|
||||
'hw_version': None,
|
||||
'id': <ANY>,
|
||||
'identifiers': set({
|
||||
tuple(
|
||||
'lametric',
|
||||
'SA52100000123TBNC',
|
||||
),
|
||||
}),
|
||||
'labels': set({
|
||||
}),
|
||||
'manufacturer': 'LaMetric Inc.',
|
||||
'model': 'SKY',
|
||||
'model_id': 'sa5',
|
||||
'name': "spyfly's LaMetric SKY",
|
||||
'name_by_user': None,
|
||||
'serial_number': 'SA52100000123TBNC',
|
||||
'sw_version': '3.0.13',
|
||||
'via_device_id': None,
|
||||
})
|
||||
# ---
|
||||
@@ -8,14 +8,38 @@ from demetriek import (
|
||||
LaMetricConnectionTimeoutError,
|
||||
)
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.lametric.const import DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_REAUTH, ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("device_fixture", "serial_number"),
|
||||
[
|
||||
("device", "SA110405124500W00BS9"),
|
||||
("device_sa5", "SA52100000123TBNC"),
|
||||
],
|
||||
)
|
||||
async def test_device_info(
|
||||
hass: HomeAssistant,
|
||||
snapshot: SnapshotAssertion,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
init_integration: MockConfigEntry,
|
||||
serial_number: str,
|
||||
) -> None:
|
||||
"""Test the device registry entry."""
|
||||
device_entry = device_registry.async_get_device_by_identifier(
|
||||
(DOMAIN, serial_number), init_integration.entry_id
|
||||
)
|
||||
assert device_entry is not None
|
||||
assert device_entry == snapshot
|
||||
|
||||
|
||||
async def test_load_unload_config_entry(
|
||||
hass: HomeAssistant,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
|
||||
Reference in New Issue
Block a user