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
f1f23c04
Unverified
Commit
f1f23c04
authored
4 years ago
by
Alexei Chetroi
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Better parsing of the ZHA device profile id (#41024)
parent
aba3cdc7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
homeassistant/components/zha/core/device.py
+16
-23
16 additions, 23 deletions
homeassistant/components/zha/core/device.py
with
16 additions
and
23 deletions
homeassistant/components/zha/core/device.py
+
16
−
23
View file @
f1f23c04
...
...
@@ -9,7 +9,7 @@ from typing import Any, Dict
from
zigpy
import
types
import
zigpy.exceptions
from
zigpy.profiles
import
zha
,
zll
from
zigpy.profiles
import
PROFILES
import
zigpy.quirks
from
zigpy.zcl.clusters.general
import
Groups
import
zigpy.zdo.types
as
zdo_types
...
...
@@ -456,27 +456,20 @@ class ZHADevice(LogMixin):
]
# Return endpoint device type Names
try
:
device_info
[
ATTR_ENDPOINT_NAMES
]
=
[
{
"
name
"
:
endpoint
.
device_type
.
name
,
}
for
(
ep_id
,
endpoint
)
in
self
.
_zigpy_device
.
endpoints
.
items
()
if
ep_id
!=
0
and
endpoint
.
profile_id
in
(
zha
.
PROFILE_ID
,
zll
.
PROFILE_ID
)
]
except
AttributeError
as
ex
:
# Some device types are not using an enumeration
self
.
warning
(
"
Failed to identify endpoint name in
'
%s
'
with exception
'
%s
'"
,
self
.
_zigpy_device
.
endpoints
.
items
(),
ex
,
)
device_info
[
ATTR_ENDPOINT_NAMES
]
=
[
{
"
name
"
:
"
unknown
"
,
}
]
names
=
[]
for
endpoint
in
(
ep
for
epid
,
ep
in
self
.
device
.
endpoints
.
items
()
if
epid
):
profile
=
PROFILES
.
get
(
endpoint
.
profile_id
)
if
profile
and
endpoint
.
device_type
is
not
None
:
# DeviceType provides undefined enums
names
.
append
({
ATTR_NAME
:
profile
.
DeviceType
(
endpoint
.
device_type
).
name
})
else
:
names
.
append
(
{
ATTR_NAME
:
f
"
unknown
{
endpoint
.
device_type
}
device_type
"
"
of 0x{endpoint.profile_id:04x} profile id
"
}
)
device_info
[
ATTR_ENDPOINT_NAMES
]
=
names
reg_device
=
self
.
gateway
.
ha_device_registry
.
async_get
(
self
.
device_id
)
if
reg_device
is
not
None
:
...
...
@@ -516,7 +509,7 @@ class ZHADevice(LogMixin):
CLUSTER_TYPE_OUT
:
endpoint
.
out_clusters
,
}
for
(
ep_id
,
endpoint
)
in
self
.
_zigpy_device
.
endpoints
.
items
()
if
ep_id
!=
0
and
endpoint
.
profile_id
in
(
zha
.
PROFILE
_ID
,
zll
.
PROFILE_ID
)
if
ep_id
!=
0
and
endpoint
.
profile_id
in
PROFILE
S
}
@callback
...
...
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