Skip to content

Commit fe4eb87

Browse files
authored
Don't mark ZHA coordinator as via_device with itself (home-assistant#154004)
1 parent 2d9f14c commit fe4eb87

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

homeassistant/components/zha/entity.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111
from propcache.api import cached_property
1212
from zha.mixins import LogMixin
1313

14-
from homeassistant.const import ATTR_MANUFACTURER, ATTR_MODEL, ATTR_NAME, EntityCategory
14+
from homeassistant.const import (
15+
ATTR_MANUFACTURER,
16+
ATTR_MODEL,
17+
ATTR_NAME,
18+
ATTR_VIA_DEVICE,
19+
EntityCategory,
20+
)
1521
from homeassistant.core import State, callback
1622
from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE, DeviceInfo
1723
from homeassistant.helpers.dispatcher import async_dispatcher_connect
@@ -85,14 +91,19 @@ def device_info(self) -> DeviceInfo:
8591
ieee = zha_device_info["ieee"]
8692
zha_gateway = self.entity_data.device_proxy.gateway_proxy.gateway
8793

88-
return DeviceInfo(
94+
device_info = DeviceInfo(
8995
connections={(CONNECTION_ZIGBEE, ieee)},
9096
identifiers={(DOMAIN, ieee)},
9197
manufacturer=zha_device_info[ATTR_MANUFACTURER],
9298
model=zha_device_info[ATTR_MODEL],
9399
name=zha_device_info[ATTR_NAME],
94-
via_device=(DOMAIN, str(zha_gateway.state.node_info.ieee)),
95100
)
101+
if ieee != str(zha_gateway.state.node_info.ieee):
102+
device_info[ATTR_VIA_DEVICE] = (
103+
DOMAIN,
104+
str(zha_gateway.state.node_info.ieee),
105+
)
106+
return device_info
96107

97108
@callback
98109
def _handle_entity_events(self, event: Any) -> None:

0 commit comments

Comments
 (0)