Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
3d3bc1ca
Unverified
Commit
3d3bc1ca
authored
8 months ago
by
Marcel van der Veldt
Committed by
GitHub
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Revert "Add mac address as connection for matter device (#121257)" (#122133)
parent
bf0e5baa
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
homeassistant/components/matter/adapter.py
+0
-30
0 additions, 30 deletions
homeassistant/components/matter/adapter.py
tests/components/matter/test_adapter.py
+0
-54
0 additions, 54 deletions
tests/components/matter/test_adapter.py
with
0 additions
and
84 deletions
homeassistant/components/matter/adapter.py
+
0
−
30
View file @
3d3bc1ca
...
...
@@ -4,9 +4,7 @@ from __future__ import annotations
from
typing
import
TYPE_CHECKING
,
cast
from
chip.clusters.Objects
import
GeneralDiagnostics
from
matter_server.client.models.device_types
import
BridgedDevice
from
matter_server.common.helpers.util
import
convert_mac_address
from
matter_server.common.models
import
EventType
,
ServerInfoMessage
from
homeassistant.config_entries
import
ConfigEntry
...
...
@@ -24,30 +22,6 @@ if TYPE_CHECKING:
from
matter_server.client.models.node
import
MatterEndpoint
,
MatterNode
def
get_connections_for_endpoint
(
endpoint
:
MatterEndpoint
)
->
set
[
tuple
[
str
,
str
]]:
"""
Return a set of connections for a MatterEndpoint.
"""
network_interfaces
:
list
[
GeneralDiagnostics
.
Structs
.
NetworkInterface
]
=
(
endpoint
.
get_attribute_value
(
None
,
GeneralDiagnostics
.
Attributes
.
NetworkInterfaces
)
or
[]
)
hardware_addresses
:
set
[
str
]
=
{
convert_mac_address
(
network_interface
.
hardwareAddress
)
for
network_interface
in
network_interfaces
if
network_interface
.
hardwareAddress
}
return
{
(
dr
.
CONNECTION_NETWORK_MAC
,
address
)
if
len
(
address
)
==
17
else
(
dr
.
CONNECTION_ZIGBEE
,
address
)
for
address
in
hardware_addresses
if
len
(
address
)
in
(
17
,
23
)
# EUI-48 -> 17, EUI-64 -> 23
}
def
get_clean_name
(
name
:
str
|
None
)
->
str
|
None
:
"""
Strip spaces and null char from the name.
"""
if
name
is
None
:
...
...
@@ -211,9 +185,6 @@ class MatterAdapter:
endpoint
,
)
identifiers
=
{(
DOMAIN
,
f
"
{
ID_TYPE_DEVICE_ID
}
_
{
node_device_id
}
"
)}
connections
=
get_connections_for_endpoint
(
endpoint
)
serial_number
:
str
|
None
=
None
# if available, we also add the serialnumber as identifier
if
(
...
...
@@ -232,7 +203,6 @@ class MatterAdapter:
name
=
name
,
config_entry_id
=
self
.
config_entry
.
entry_id
,
identifiers
=
identifiers
,
connections
=
connections
,
hw_version
=
basic_info
.
hardwareVersionString
,
sw_version
=
basic_info
.
softwareVersionString
,
manufacturer
=
basic_info
.
vendorName
or
endpoint
.
node
.
device_info
.
vendorName
,
...
...
This diff is collapsed.
Click to expand it.
tests/components/matter/test_adapter.py
+
0
−
54
View file @
3d3bc1ca
...
...
@@ -187,60 +187,6 @@ async def test_device_registry_single_node_composed_device(
assert
len
(
dev_reg
.
devices
)
==
1
async
def
test_device_registry_single_node_with_connection
(
hass
:
HomeAssistant
,
device_registry
:
dr
.
DeviceRegistry
,
matter_client
:
MagicMock
,
)
->
None
:
"""
Test that a device with mac address adds a connection to the HA device entry.
"""
await
setup_integration_with_node_fixture
(
hass
,
"
thermostat
"
,
matter_client
,
)
assert
device_registry
.
async_get_device
(
connections
=
{(
"
mac
"
,
"
DC:54:75:5F:BA:AC
"
)})
async
def
test_device_registry_single_node_without_mac_address_has_no_mac_connection
(
hass
:
HomeAssistant
,
device_registry
:
dr
.
DeviceRegistry
,
matter_client
:
MagicMock
,
)
->
None
:
"""
Test that a device without mac address doesn
'
t have a `mac` connection in the HA device entry.
"""
await
setup_integration_with_node_fixture
(
hass
,
"
temperature-sensor
"
,
matter_client
,
)
entry
=
device_registry
.
async_get_device
(
identifiers
=
{
(
DOMAIN
,
"
deviceid_00000000000004D2-0000000000000001-MatterNodeDevice
"
)
}
)
for
connection_type
,
_
in
entry
.
connections
:
assert
connection_type
!=
dr
.
CONNECTION_NETWORK_MAC
async
def
test_device_registry_node_with_EUI64_address
(
hass
:
HomeAssistant
,
device_registry
:
dr
.
DeviceRegistry
,
matter_client
:
MagicMock
,
)
->
None
:
"""
Test that a device with a mac address has a `zigbee` connection in the HA device entry.
"""
await
setup_integration_with_node_fixture
(
hass
,
"
eve-energy-plug
"
,
matter_client
,
)
assert
device_registry
.
async_get_device
(
connections
=
{(
"
zigbee
"
,
"
ca:6b:4a:23:f6:f8:bb:ee
"
)}
)
async
def
test_multi_endpoint_name
(
hass
:
HomeAssistant
,
matter_client
:
MagicMock
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment