Skip to content

Commit 303e4ce

Browse files
authored
Add mac address to Velux device (home-assistant#156376)
1 parent 76f2929 commit 303e4ce

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

homeassistant/components/velux/__init__.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
from pyvlx import PyVLX, PyVLXException
66

77
from homeassistant.config_entries import ConfigEntry
8-
from homeassistant.const import CONF_HOST, CONF_PASSWORD, EVENT_HOMEASSISTANT_STOP
8+
from homeassistant.const import (
9+
CONF_HOST,
10+
CONF_MAC,
11+
CONF_PASSWORD,
12+
EVENT_HOMEASSISTANT_STOP,
13+
)
914
from homeassistant.core import HomeAssistant, ServiceCall
1015
from homeassistant.helpers import device_registry as dr, issue_registry as ir
1116

@@ -30,6 +35,10 @@ async def async_setup_entry(hass: HomeAssistant, entry: VeluxConfigEntry) -> boo
3035

3136
entry.runtime_data = pyvlx
3237

38+
connections = None
39+
if (mac := entry.data.get(CONF_MAC)) is not None:
40+
connections = {(dr.CONNECTION_NETWORK_MAC, mac)}
41+
3342
device_registry = dr.async_get(hass)
3443
device_registry.async_get_or_create(
3544
config_entry_id=entry.entry_id,
@@ -43,6 +52,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: VeluxConfigEntry) -> boo
4352
sw_version=(
4453
str(pyvlx.klf200.version.softwareversion) if pyvlx.klf200.version else None
4554
),
55+
connections=connections,
4656
)
4757

4858
async def on_hass_stop(event):

0 commit comments

Comments
 (0)