Use SensorDeviceClass.DISTANCE in components (#79285)
* Use SensorDeviceClass.DISTANCE in components * Adjust mysensors
This commit is contained in:
parent
c527defe31
commit
4bd686bdb1
7 changed files with 7 additions and 1 deletions
|
@ -170,6 +170,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
key="visibility",
|
key="visibility",
|
||||||
name="Visibility",
|
name="Visibility",
|
||||||
native_unit_of_measurement=LENGTH_KILOMETERS,
|
native_unit_of_measurement=LENGTH_KILOMETERS,
|
||||||
|
device_class=SensorDeviceClass.DISTANCE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
|
|
|
@ -172,6 +172,7 @@ SENSOR_TYPES: tuple[ECSensorEntityDescription, ...] = (
|
||||||
key="visibility",
|
key="visibility",
|
||||||
name="Visibility",
|
name="Visibility",
|
||||||
native_unit_of_measurement=LENGTH_KILOMETERS,
|
native_unit_of_measurement=LENGTH_KILOMETERS,
|
||||||
|
device_class=SensorDeviceClass.DISTANCE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
value_fn=lambda data: data.conditions.get("visibility", {}).get("value"),
|
value_fn=lambda data: data.conditions.get("visibility", {}).get("value"),
|
||||||
),
|
),
|
||||||
|
|
|
@ -114,8 +114,8 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="visibility_distance",
|
key="visibility_distance",
|
||||||
name="Visibility distance",
|
name="Visibility distance",
|
||||||
device_class=None,
|
|
||||||
native_unit_of_measurement=LENGTH_KILOMETERS,
|
native_unit_of_measurement=LENGTH_KILOMETERS,
|
||||||
|
device_class=SensorDeviceClass.DISTANCE,
|
||||||
icon="mdi:eye",
|
icon="mdi:eye",
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
),
|
),
|
||||||
|
|
|
@ -100,6 +100,7 @@ SENSORS: dict[str, SensorEntityDescription] = {
|
||||||
"V_DISTANCE": SensorEntityDescription(
|
"V_DISTANCE": SensorEntityDescription(
|
||||||
key="V_DISTANCE",
|
key="V_DISTANCE",
|
||||||
native_unit_of_measurement=LENGTH_METERS,
|
native_unit_of_measurement=LENGTH_METERS,
|
||||||
|
device_class=SensorDeviceClass.DISTANCE,
|
||||||
icon="mdi:ruler",
|
icon="mdi:ruler",
|
||||||
),
|
),
|
||||||
"V_IMPEDANCE": SensorEntityDescription(
|
"V_IMPEDANCE": SensorEntityDescription(
|
||||||
|
|
|
@ -29,6 +29,7 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key="dist",
|
key="dist",
|
||||||
native_unit_of_measurement=LENGTH_CENTIMETERS,
|
native_unit_of_measurement=LENGTH_CENTIMETERS,
|
||||||
|
device_class=SensorDeviceClass.DISTANCE,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
|
|
|
@ -81,6 +81,7 @@ SENSOR_TYPES: tuple[StarlineSensorEntityDescription, ...] = (
|
||||||
key="mileage",
|
key="mileage",
|
||||||
name_="Mileage",
|
name_="Mileage",
|
||||||
native_unit_of_measurement=LENGTH_KILOMETERS,
|
native_unit_of_measurement=LENGTH_KILOMETERS,
|
||||||
|
device_class=SensorDeviceClass.DISTANCE,
|
||||||
icon="mdi:counter",
|
icon="mdi:counter",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
@ -85,6 +85,7 @@ SENSOR_TYPES: dict[str, WallboxSensorEntityDescription] = {
|
||||||
name="Added Range",
|
name="Added Range",
|
||||||
precision=0,
|
precision=0,
|
||||||
native_unit_of_measurement=LENGTH_KILOMETERS,
|
native_unit_of_measurement=LENGTH_KILOMETERS,
|
||||||
|
device_class=SensorDeviceClass.DISTANCE,
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
),
|
),
|
||||||
CHARGER_ADDED_ENERGY_KEY: WallboxSensorEntityDescription(
|
CHARGER_ADDED_ENERGY_KEY: WallboxSensorEntityDescription(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue