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
d7edb5b1
Unverified
Commit
d7edb5b1
authored
3 years ago
by
epenet
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use DeviceInfo in syncthru (#58581)
Co-authored-by:
epenet
<
epenet@users.noreply.github.com
>
parent
03100693
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/syncthru/binary_sensor.py
+8
-2
8 additions, 2 deletions
homeassistant/components/syncthru/binary_sensor.py
homeassistant/components/syncthru/sensor.py
+8
-2
8 additions, 2 deletions
homeassistant/components/syncthru/sensor.py
with
16 additions
and
4 deletions
homeassistant/components/syncthru/binary_sensor.py
+
8
−
2
View file @
d7edb5b1
"""
Support for Samsung Printers with SyncThru web interface.
"""
"""
Support for Samsung Printers with SyncThru web interface.
"""
from
__future__
import
annotations
from
pysyncthru
import
SyncThru
,
SyncthruState
from
pysyncthru
import
SyncThru
,
SyncthruState
...
@@ -8,6 +9,7 @@ from homeassistant.components.binary_sensor import (
...
@@ -8,6 +9,7 @@ from homeassistant.components.binary_sensor import (
BinarySensorEntity
,
BinarySensorEntity
,
)
)
from
homeassistant.const
import
CONF_NAME
from
homeassistant.const
import
CONF_NAME
from
homeassistant.helpers.entity
import
DeviceInfo
from
homeassistant.helpers.update_coordinator
import
(
from
homeassistant.helpers.update_coordinator
import
(
CoordinatorEntity
,
CoordinatorEntity
,
DataUpdateCoordinator
,
DataUpdateCoordinator
,
...
@@ -63,9 +65,13 @@ class SyncThruBinarySensor(CoordinatorEntity, BinarySensorEntity):
...
@@ -63,9 +65,13 @@ class SyncThruBinarySensor(CoordinatorEntity, BinarySensorEntity):
return
self
.
_name
return
self
.
_name
@property
@property
def
device_info
(
self
):
def
device_info
(
self
)
->
DeviceInfo
|
None
:
"""
Return device information.
"""
"""
Return device information.
"""
return
{
"
identifiers
"
:
device_identifiers
(
self
.
syncthru
)}
if
(
identifiers
:
=
device_identifiers
(
self
.
syncthru
))
is
None
:
return
None
return
DeviceInfo
(
identifiers
=
identifiers
,
)
class
SyncThruOnlineSensor
(
SyncThruBinarySensor
):
class
SyncThruOnlineSensor
(
SyncThruBinarySensor
):
...
...
This diff is collapsed.
Click to expand it.
homeassistant/components/syncthru/sensor.py
+
8
−
2
View file @
d7edb5b1
"""
Support for Samsung Printers with SyncThru web interface.
"""
"""
Support for Samsung Printers with SyncThru web interface.
"""
from
__future__
import
annotations
import
logging
import
logging
...
@@ -9,6 +10,7 @@ from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
...
@@ -9,6 +10,7 @@ from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from
homeassistant.config_entries
import
SOURCE_IMPORT
from
homeassistant.config_entries
import
SOURCE_IMPORT
from
homeassistant.const
import
CONF_NAME
,
CONF_RESOURCE
,
CONF_URL
,
PERCENTAGE
from
homeassistant.const
import
CONF_NAME
,
CONF_RESOURCE
,
CONF_URL
,
PERCENTAGE
import
homeassistant.helpers.config_validation
as
cv
import
homeassistant.helpers.config_validation
as
cv
from
homeassistant.helpers.entity
import
DeviceInfo
from
homeassistant.helpers.update_coordinator
import
(
from
homeassistant.helpers.update_coordinator
import
(
CoordinatorEntity
,
CoordinatorEntity
,
DataUpdateCoordinator
,
DataUpdateCoordinator
,
...
@@ -129,9 +131,13 @@ class SyncThruSensor(CoordinatorEntity, SensorEntity):
...
@@ -129,9 +131,13 @@ class SyncThruSensor(CoordinatorEntity, SensorEntity):
return
self
.
_unit_of_measurement
return
self
.
_unit_of_measurement
@property
@property
def
device_info
(
self
):
def
device_info
(
self
)
->
DeviceInfo
|
None
:
"""
Return device information.
"""
"""
Return device information.
"""
return
{
"
identifiers
"
:
device_identifiers
(
self
.
syncthru
)}
if
(
identifiers
:
=
device_identifiers
(
self
.
syncthru
))
is
None
:
return
None
return
DeviceInfo
(
identifiers
=
identifiers
,
)
class
SyncThruMainSensor
(
SyncThruSensor
):
class
SyncThruMainSensor
(
SyncThruSensor
):
...
...
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