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
8cb7e978
Unverified
Commit
8cb7e978
authored
8 months ago
by
Matrix
Committed by
GitHub
8 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Add YoLink YS8017 support (#122064)
parent
16434b53
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/yolink/const.py
+2
-0
2 additions, 0 deletions
homeassistant/components/yolink/const.py
homeassistant/components/yolink/sensor.py
+8
-2
8 additions, 2 deletions
homeassistant/components/yolink/sensor.py
with
10 additions
and
2 deletions
homeassistant/components/yolink/const.py
+
2
−
0
View file @
8cb7e978
...
...
@@ -17,3 +17,5 @@ YOLINK_OFFLINE_TIME = 32400
DEV_MODEL_WATER_METER_YS5007
=
"
YS5007
"
DEV_MODEL_MULTI_OUTLET_YS6801
=
"
YS6801
"
DEV_MODEL_TH_SENSOR_YS8017_UC
=
"
YS8017-UC
"
DEV_MODEL_TH_SENSOR_YS8017_EC
=
"
YS8017-EC
"
This diff is collapsed.
Click to expand it.
homeassistant/components/yolink/sensor.py
+
8
−
2
View file @
8cb7e978
...
...
@@ -48,7 +48,7 @@ from homeassistant.core import HomeAssistant, callback
from
homeassistant.helpers.entity_platform
import
AddEntitiesCallback
from
homeassistant.util
import
percentage
from
.const
import
DOMAIN
from
.const
import
DEV_MODEL_TH_SENSOR_YS8017_EC
,
DEV_MODEL_TH_SENSOR_YS8017_UC
,
DOMAIN
from
.coordinator
import
YoLinkCoordinator
from
.entity
import
YoLinkEntity
...
...
@@ -108,6 +108,11 @@ MCU_DEV_TEMPERATURE_SENSOR = [
ATTR_DEVICE_CO_SMOKE_SENSOR
,
]
NONE_HUMIDITY_SENSOR_MODELS
=
[
DEV_MODEL_TH_SENSOR_YS8017_UC
,
DEV_MODEL_TH_SENSOR_YS8017_EC
,
]
def
cvt_battery
(
val
:
int
|
None
)
->
int
|
None
:
"""
Convert battery to percentage.
"""
...
...
@@ -141,7 +146,8 @@ SENSOR_TYPES: tuple[YoLinkSensorEntityDescription, ...] = (
device_class
=
SensorDeviceClass
.
HUMIDITY
,
native_unit_of_measurement
=
PERCENTAGE
,
state_class
=
SensorStateClass
.
MEASUREMENT
,
exists_fn
=
lambda
device
:
device
.
device_type
in
[
ATTR_DEVICE_TH_SENSOR
],
exists_fn
=
lambda
device
:
device
.
device_type
in
[
ATTR_DEVICE_TH_SENSOR
]
and
device
.
device_model_name
not
in
NONE_HUMIDITY_SENSOR_MODELS
,
),
YoLinkSensorEntityDescription
(
key
=
"
temperature
"
,
...
...
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