diff --git a/homeassistant/components/twinkly/light.py b/homeassistant/components/twinkly/light.py index 6f6dffe63d2..771af2282dc 100644 --- a/homeassistant/components/twinkly/light.py +++ b/homeassistant/components/twinkly/light.py @@ -28,7 +28,7 @@ from homeassistant.const import ( ) from homeassistant.core import HomeAssistant from homeassistant.helpers import device_registry as dr -from homeassistant.helpers.device_registry import DeviceInfo +from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback from .const import ( @@ -97,6 +97,7 @@ class TwinklyLight(LightEntity): # They are expected to be updated using the device_info. self._name = conf.data[CONF_NAME] or "Twinkly light" self._model = conf.data[CONF_MODEL] + self._mac = device_info["mac"] self._client = client @@ -114,6 +115,7 @@ class TwinklyLight(LightEntity): """Get device specific attributes.""" return DeviceInfo( identifiers={(DOMAIN, self._attr_unique_id)}, + connections={(CONNECTION_NETWORK_MAC, self._mac)}, manufacturer="LEDWORKS", model=self._model, name=self._name, diff --git a/tests/components/twinkly/__init__.py b/tests/components/twinkly/__init__.py index f322004962a..192a5c0e220 100644 --- a/tests/components/twinkly/__init__.py +++ b/tests/components/twinkly/__init__.py @@ -7,6 +7,7 @@ from homeassistant.components.twinkly.const import DEV_NAME TEST_HOST = "test.twinkly.com" TEST_ID = "twinkly_test_device_id" TEST_UID = "4c8fccf5-e08a-4173-92d5-49bf479252a2" +TEST_MAC = "aa:bb:cc:dd:ee:ff" TEST_NAME = "twinkly_test_device_name" TEST_NAME_ORIGINAL = "twinkly_test_original_device_name" # the original (deprecated) name stored in the conf TEST_MODEL = "twinkly_test_device_model" @@ -31,6 +32,7 @@ class ClientMock: self.device_info = { "uuid": self.id, "device_name": TEST_NAME, + "mac": TEST_MAC, "product_code": TEST_MODEL, } diff --git a/tests/components/twinkly/snapshots/test_diagnostics.ambr b/tests/components/twinkly/snapshots/test_diagnostics.ambr index 28ec98cf572..4d25e222501 100644 --- a/tests/components/twinkly/snapshots/test_diagnostics.ambr +++ b/tests/components/twinkly/snapshots/test_diagnostics.ambr @@ -15,6 +15,7 @@ }), 'device_info': dict({ 'device_name': 'twinkly_test_device_name', + 'mac': '**REDACTED**', 'product_code': 'twinkly_test_device_model', 'uuid': '4c8fccf5-e08a-4173-92d5-49bf479252a2', }),