mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 01:38:02 +00:00
Add unique-ids to maxcube component (#49196)
This commit is contained in:
parent
8ce74e598d
commit
aaa600e00a
@ -35,6 +35,11 @@ class MaxCubeShutter(BinarySensorEntity):
|
||||
"""Return the name of the BinarySensorEntity."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return a unique ID."""
|
||||
return self._device.serial
|
||||
|
||||
@property
|
||||
def device_class(self):
|
||||
"""Return the class of this sensor."""
|
||||
|
@ -87,6 +87,11 @@ class MaxCubeClimate(ClimateEntity):
|
||||
"""Return the name of the climate device."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
"""Return a unique ID."""
|
||||
return self._device.serial
|
||||
|
||||
@property
|
||||
def min_temp(self):
|
||||
"""Return the minimum temperature."""
|
||||
|
@ -11,6 +11,7 @@ from homeassistant.const import (
|
||||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.util import utcnow
|
||||
|
||||
from tests.common import async_fire_time_changed
|
||||
@ -20,6 +21,11 @@ ENTITY_ID = "binary_sensor.testroom_testshutter"
|
||||
|
||||
async def test_window_shuttler(hass, cube: MaxCube, windowshutter: MaxWindowShutter):
|
||||
"""Test a successful setup with a shuttler device."""
|
||||
entity_registry = er.async_get(hass)
|
||||
assert entity_registry.async_is_registered(ENTITY_ID)
|
||||
entity = entity_registry.async_get(ENTITY_ID)
|
||||
assert entity.unique_id == "AABBCCDD03"
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state is not None
|
||||
assert state.state == STATE_ON
|
||||
|
@ -54,6 +54,7 @@ from homeassistant.const import (
|
||||
ATTR_SUPPORTED_FEATURES,
|
||||
ATTR_TEMPERATURE,
|
||||
)
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.util import utcnow
|
||||
|
||||
from tests.common import async_fire_time_changed
|
||||
@ -65,6 +66,10 @@ VALVE_POSITION = "valve_position"
|
||||
|
||||
async def test_setup_thermostat(hass, cube: MaxCube):
|
||||
"""Test a successful setup of a thermostat device."""
|
||||
entity_registry = er.async_get(hass)
|
||||
assert entity_registry.async_is_registered(ENTITY_ID)
|
||||
entity = entity_registry.async_get(ENTITY_ID)
|
||||
assert entity.unique_id == "AABBCCDD01"
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state.state == HVAC_MODE_AUTO
|
||||
@ -94,6 +99,11 @@ async def test_setup_thermostat(hass, cube: MaxCube):
|
||||
|
||||
async def test_setup_wallthermostat(hass, cube: MaxCube):
|
||||
"""Test a successful setup of a wall thermostat device."""
|
||||
entity_registry = er.async_get(hass)
|
||||
assert entity_registry.async_is_registered(WALL_ENTITY_ID)
|
||||
entity = entity_registry.async_get(WALL_ENTITY_ID)
|
||||
assert entity.unique_id == "AABBCCDD02"
|
||||
|
||||
state = hass.states.get(WALL_ENTITY_ID)
|
||||
assert state.state == HVAC_MODE_OFF
|
||||
assert state.attributes.get(ATTR_FRIENDLY_NAME) == "TestRoom TestWallThermostat"
|
||||
|
Loading…
x
Reference in New Issue
Block a user