diff --git a/homeassistant/components/demo/fan.py b/homeassistant/components/demo/fan.py index 4b75e817153..ee49f0a2e99 100644 --- a/homeassistant/components/demo/fan.py +++ b/homeassistant/components/demo/fan.py @@ -18,8 +18,8 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info= """Set up the demo fan platform.""" async_add_entities( [ - DemoFan(hass, "Living Room Fan", FULL_SUPPORT), - DemoFan(hass, "Ceiling Fan", LIMITED_SUPPORT), + DemoFan(hass, "fan1", "Living Room Fan", FULL_SUPPORT), + DemoFan(hass, "fan2", "Ceiling Fan", LIMITED_SUPPORT), ] ) @@ -32,9 +32,12 @@ async def async_setup_entry(hass, config_entry, async_add_entities): class DemoFan(FanEntity): """A demonstration fan component.""" - def __init__(self, hass, name: str, supported_features: int) -> None: + def __init__( + self, hass, unique_id: str, name: str, supported_features: int + ) -> None: """Initialize the entity.""" self.hass = hass + self._unique_id = unique_id self._supported_features = supported_features self._speed = STATE_OFF self._oscillating = None @@ -46,6 +49,11 @@ class DemoFan(FanEntity): if supported_features & SUPPORT_DIRECTION: self._direction = "forward" + @property + def unique_id(self): + """Return the unique id.""" + return self._unique_id + @property def name(self) -> str: """Get entity name."""