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
36585558
Unverified
Commit
36585558
authored
5 years ago
by
Alexei Chetroi
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Refactor ZHA channel logging (#30259)
Add channel.id property -- id unique for this the device only.
parent
08af9896
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/channels/__init__.py
+9
-9
9 additions, 9 deletions
homeassistant/components/zha/core/channels/__init__.py
with
9 additions
and
9 deletions
homeassistant/components/zha/core/channels/__init__.py
+
9
−
9
View file @
36585558
...
@@ -89,19 +89,19 @@ class ZigbeeChannel(LogMixin):
...
@@ -89,19 +89,19 @@ class ZigbeeChannel(LogMixin):
self
.
_generic_id
=
f
"
channel_0x
{
cluster
.
cluster_id
:
04
x
}
"
self
.
_generic_id
=
f
"
channel_0x
{
cluster
.
cluster_id
:
04
x
}
"
self
.
_cluster
=
cluster
self
.
_cluster
=
cluster
self
.
_zha_device
=
device
self
.
_zha_device
=
device
self
.
_unique_id
=
"
{}:{}:0x{:04x}
"
.
format
(
self
.
_id
=
f
"
{
cluster
.
endpoint
.
endpoint_id
}
:0x
{
cluster
.
cluster_id
:
04
x
}
"
str
(
device
.
ieee
),
cluster
.
endpoint
.
endpoint_id
,
cluster
.
cluster_id
self
.
_unique_id
=
f
"
{
str
(
device
.
ieee
)
}
:
{
self
.
_id
}
"
)
# this keeps logs consistent with zigpy logging
self
.
_log_id
=
"
0x{:04x}:{}:0x{:04x}
"
.
format
(
device
.
nwk
,
cluster
.
endpoint
.
endpoint_id
,
cluster
.
cluster_id
)
self
.
_report_config
=
CLUSTER_REPORT_CONFIGS
.
get
(
self
.
_report_config
=
CLUSTER_REPORT_CONFIGS
.
get
(
self
.
_cluster
.
cluster_id
,
self
.
REPORT_CONFIG
self
.
_cluster
.
cluster_id
,
self
.
REPORT_CONFIG
)
)
self
.
_status
=
ChannelStatus
.
CREATED
self
.
_status
=
ChannelStatus
.
CREATED
self
.
_cluster
.
add_listener
(
self
)
self
.
_cluster
.
add_listener
(
self
)
@property
def
id
(
self
)
->
str
:
"""
Return channel id unique for this device only.
"""
return
self
.
_id
@property
@property
def
generic_id
(
self
):
def
generic_id
(
self
):
"""
Return the generic id for this channel.
"""
"""
Return the generic id for this channel.
"""
...
@@ -263,8 +263,8 @@ class ZigbeeChannel(LogMixin):
...
@@ -263,8 +263,8 @@ class ZigbeeChannel(LogMixin):
def
log
(
self
,
level
,
msg
,
*
args
):
def
log
(
self
,
level
,
msg
,
*
args
):
"""
Log a message.
"""
"""
Log a message.
"""
msg
=
"
[%s]:
"
+
msg
msg
=
"
[%s
:%s
]:
"
+
msg
args
=
(
self
.
_log
_id
,)
+
args
args
=
(
self
.
device
.
nwk
,
self
.
_id
,)
+
args
_LOGGER
.
log
(
level
,
msg
,
*
args
)
_LOGGER
.
log
(
level
,
msg
,
*
args
)
def
__getattr__
(
self
,
name
):
def
__getattr__
(
self
,
name
):
...
...
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