Add new data rate device class (#83377)

pull/83450/head
epenet 2022-12-08 18:20:05 +01:00 committed by GitHub
parent c4afc33fc5
commit 9987f7a125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 1 deletions

View File

@ -93,6 +93,12 @@ class NumberDeviceClass(StrEnum):
Unit of measurement: `A`
"""
DATA_RATE = "data_rate"
"""Data rate.
Unit of measurement: UnitOfDataRate
"""
DATA_SIZE = "data_size"
"""Data size.

View File

@ -157,6 +157,12 @@ class SensorDeviceClass(StrEnum):
Unit of measurement: `A`
"""
DATA_RATE = "data_rate"
"""Data rate.
Unit of measurement: UnitOfDataRate
"""
DATA_SIZE = "data_size"
"""Data size.

View File

@ -36,6 +36,7 @@ CONF_IS_BATTERY_LEVEL = "is_battery_level"
CONF_IS_CO = "is_carbon_monoxide"
CONF_IS_CO2 = "is_carbon_dioxide"
CONF_IS_CURRENT = "is_current"
CONF_IS_DATA_RATE = "is_data_rate"
CONF_IS_DATA_SIZE = "is_data_size"
CONF_IS_DISTANCE = "is_distance"
CONF_IS_ENERGY = "is_energy"
@ -75,6 +76,7 @@ ENTITY_CONDITIONS = {
SensorDeviceClass.CO: [{CONF_TYPE: CONF_IS_CO}],
SensorDeviceClass.CO2: [{CONF_TYPE: CONF_IS_CO2}],
SensorDeviceClass.CURRENT: [{CONF_TYPE: CONF_IS_CURRENT}],
SensorDeviceClass.DATA_RATE: [{CONF_TYPE: CONF_IS_DATA_RATE}],
SensorDeviceClass.DATA_SIZE: [{CONF_TYPE: CONF_IS_DATA_SIZE}],
SensorDeviceClass.DISTANCE: [{CONF_TYPE: CONF_IS_DISTANCE}],
SensorDeviceClass.ENERGY: [{CONF_TYPE: CONF_IS_ENERGY}],
@ -124,6 +126,7 @@ CONDITION_SCHEMA = vol.All(
CONF_IS_CO,
CONF_IS_CO2,
CONF_IS_CURRENT,
CONF_IS_DATA_RATE,
CONF_IS_DATA_SIZE,
CONF_IS_DISTANCE,
CONF_IS_ENERGY,

View File

@ -35,6 +35,7 @@ CONF_BATTERY_LEVEL = "battery_level"
CONF_CO = "carbon_monoxide"
CONF_CO2 = "carbon_dioxide"
CONF_CURRENT = "current"
CONF_DATA_RATE = "data_rate"
CONF_DATA_SIZE = "data_size"
CONF_DISTANCE = "distance"
CONF_ENERGY = "energy"
@ -74,6 +75,7 @@ ENTITY_TRIGGERS = {
SensorDeviceClass.CO: [{CONF_TYPE: CONF_CO}],
SensorDeviceClass.CO2: [{CONF_TYPE: CONF_CO2}],
SensorDeviceClass.CURRENT: [{CONF_TYPE: CONF_CURRENT}],
SensorDeviceClass.DATA_RATE: [{CONF_TYPE: CONF_DATA_RATE}],
SensorDeviceClass.DATA_SIZE: [{CONF_TYPE: CONF_DATA_SIZE}],
SensorDeviceClass.DISTANCE: [{CONF_TYPE: CONF_DISTANCE}],
SensorDeviceClass.ENERGY: [{CONF_TYPE: CONF_ENERGY}],
@ -124,6 +126,7 @@ TRIGGER_SCHEMA = vol.All(
CONF_CO,
CONF_CO2,
CONF_CURRENT,
CONF_DATA_RATE,
CONF_DATA_SIZE,
CONF_DISTANCE,
CONF_ENERGY,

View File

@ -7,6 +7,7 @@
"is_carbon_monoxide": "Current {entity_name} carbon monoxide concentration level",
"is_carbon_dioxide": "Current {entity_name} carbon dioxide concentration level",
"is_current": "Current {entity_name} current",
"is_data_rate": "Current {entity_name} data rate",
"is_data_size": "Current {entity_name} data size",
"is_distance": "Current {entity_name} distance",
"is_energy": "Current {entity_name} energy",
@ -43,7 +44,7 @@
"carbon_monoxide": "{entity_name} carbon monoxide concentration changes",
"carbon_dioxide": "{entity_name} carbon dioxide concentration changes",
"current": "{entity_name} current changes",
"data_size": "{entity_name} data size changes",
"data_rate": "{entity_name} data rate changes",
"distance": "{entity_name} distance changes",
"energy": "{entity_name} energy changes",
"frequency": "{entity_name} frequency changes",

View File

@ -6,6 +6,7 @@
"is_carbon_dioxide": "Current {entity_name} carbon dioxide concentration level",
"is_carbon_monoxide": "Current {entity_name} carbon monoxide concentration level",
"is_current": "Current {entity_name} current",
"is_data_rate": "Current {entity_name} data rate",
"is_data_size": "Current {entity_name} data size",
"is_distance": "Current {entity_name} distance",
"is_energy": "Current {entity_name} energy",
@ -42,6 +43,7 @@
"carbon_dioxide": "{entity_name} carbon dioxide concentration changes",
"carbon_monoxide": "{entity_name} carbon monoxide concentration changes",
"current": "{entity_name} current changes",
"data_rate": "{entity_name} data rate changes",
"data_size": "{entity_name} data size changes",
"distance": "{entity_name} distance changes",
"energy": "{entity_name} energy changes",