diff --git a/homeassistant/components/maxcube/binary_sensor.py b/homeassistant/components/maxcube/binary_sensor.py index 223c0e3fc99..999d7af01c5 100644 --- a/homeassistant/components/maxcube/binary_sensor.py +++ b/homeassistant/components/maxcube/binary_sensor.py @@ -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.""" diff --git a/homeassistant/components/maxcube/climate.py b/homeassistant/components/maxcube/climate.py index 75ee7ef21f0..175f44b9d0e 100644 --- a/homeassistant/components/maxcube/climate.py +++ b/homeassistant/components/maxcube/climate.py @@ -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.""" diff --git a/tests/components/maxcube/test_maxcube_binary_sensor.py b/tests/components/maxcube/test_maxcube_binary_sensor.py index db5228c5c9a..48d34a0df4e 100644 --- a/tests/components/maxcube/test_maxcube_binary_sensor.py +++ b/tests/components/maxcube/test_maxcube_binary_sensor.py @@ -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 diff --git a/tests/components/maxcube/test_maxcube_climate.py b/tests/components/maxcube/test_maxcube_climate.py index b59e1372fde..b234bbd130c 100644 --- a/tests/components/maxcube/test_maxcube_climate.py +++ b/tests/components/maxcube/test_maxcube_climate.py @@ -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"