mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Add entity translations for ld2410 BLE (#95709)
This commit is contained in:
parent
672313c8ab
commit
33f2453f33
@ -21,14 +21,10 @@ ENTITY_DESCRIPTIONS = (
|
|||||||
BinarySensorEntityDescription(
|
BinarySensorEntityDescription(
|
||||||
key="is_moving",
|
key="is_moving",
|
||||||
device_class=BinarySensorDeviceClass.MOTION,
|
device_class=BinarySensorDeviceClass.MOTION,
|
||||||
has_entity_name=True,
|
|
||||||
name="Motion",
|
|
||||||
),
|
),
|
||||||
BinarySensorEntityDescription(
|
BinarySensorEntityDescription(
|
||||||
key="is_static",
|
key="is_static",
|
||||||
device_class=BinarySensorDeviceClass.OCCUPANCY,
|
device_class=BinarySensorDeviceClass.OCCUPANCY,
|
||||||
has_entity_name=True,
|
|
||||||
name="Occupancy",
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -51,6 +47,8 @@ class LD2410BLEBinarySensor(
|
|||||||
):
|
):
|
||||||
"""Moving/static sensor for LD2410BLE."""
|
"""Moving/static sensor for LD2410BLE."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
coordinator: LD2410BLECoordinator,
|
coordinator: LD2410BLECoordinator,
|
||||||
|
@ -21,84 +21,76 @@ from .models import LD2410BLEData
|
|||||||
|
|
||||||
MOVING_TARGET_DISTANCE_DESCRIPTION = SensorEntityDescription(
|
MOVING_TARGET_DISTANCE_DESCRIPTION = SensorEntityDescription(
|
||||||
key="moving_target_distance",
|
key="moving_target_distance",
|
||||||
|
translation_key="moving_target_distance",
|
||||||
device_class=SensorDeviceClass.DISTANCE,
|
device_class=SensorDeviceClass.DISTANCE,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
entity_registry_visible_default=True,
|
entity_registry_visible_default=True,
|
||||||
has_entity_name=True,
|
|
||||||
name="Moving Target Distance",
|
|
||||||
native_unit_of_measurement=UnitOfLength.CENTIMETERS,
|
native_unit_of_measurement=UnitOfLength.CENTIMETERS,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
)
|
)
|
||||||
|
|
||||||
STATIC_TARGET_DISTANCE_DESCRIPTION = SensorEntityDescription(
|
STATIC_TARGET_DISTANCE_DESCRIPTION = SensorEntityDescription(
|
||||||
key="static_target_distance",
|
key="static_target_distance",
|
||||||
|
translation_key="static_target_distance",
|
||||||
device_class=SensorDeviceClass.DISTANCE,
|
device_class=SensorDeviceClass.DISTANCE,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
entity_registry_visible_default=True,
|
entity_registry_visible_default=True,
|
||||||
has_entity_name=True,
|
|
||||||
name="Static Target Distance",
|
|
||||||
native_unit_of_measurement=UnitOfLength.CENTIMETERS,
|
native_unit_of_measurement=UnitOfLength.CENTIMETERS,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
)
|
)
|
||||||
|
|
||||||
DETECTION_DISTANCE_DESCRIPTION = SensorEntityDescription(
|
DETECTION_DISTANCE_DESCRIPTION = SensorEntityDescription(
|
||||||
key="detection_distance",
|
key="detection_distance",
|
||||||
|
translation_key="detection_distance",
|
||||||
device_class=SensorDeviceClass.DISTANCE,
|
device_class=SensorDeviceClass.DISTANCE,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
entity_registry_visible_default=True,
|
entity_registry_visible_default=True,
|
||||||
has_entity_name=True,
|
|
||||||
name="Detection Distance",
|
|
||||||
native_unit_of_measurement=UnitOfLength.CENTIMETERS,
|
native_unit_of_measurement=UnitOfLength.CENTIMETERS,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
)
|
)
|
||||||
|
|
||||||
MOVING_TARGET_ENERGY_DESCRIPTION = SensorEntityDescription(
|
MOVING_TARGET_ENERGY_DESCRIPTION = SensorEntityDescription(
|
||||||
key="moving_target_energy",
|
key="moving_target_energy",
|
||||||
|
translation_key="moving_target_energy",
|
||||||
device_class=None,
|
device_class=None,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
entity_registry_visible_default=True,
|
entity_registry_visible_default=True,
|
||||||
has_entity_name=True,
|
|
||||||
name="Moving Target Energy",
|
|
||||||
native_unit_of_measurement="Target Energy",
|
native_unit_of_measurement="Target Energy",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
)
|
)
|
||||||
|
|
||||||
STATIC_TARGET_ENERGY_DESCRIPTION = SensorEntityDescription(
|
STATIC_TARGET_ENERGY_DESCRIPTION = SensorEntityDescription(
|
||||||
key="static_target_energy",
|
key="static_target_energy",
|
||||||
|
translation_key="static_target_energy",
|
||||||
device_class=None,
|
device_class=None,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
entity_registry_visible_default=True,
|
entity_registry_visible_default=True,
|
||||||
has_entity_name=True,
|
|
||||||
name="Static Target Energy",
|
|
||||||
native_unit_of_measurement="Target Energy",
|
native_unit_of_measurement="Target Energy",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
)
|
)
|
||||||
|
|
||||||
MAX_MOTION_GATES_DESCRIPTION = SensorEntityDescription(
|
MAX_MOTION_GATES_DESCRIPTION = SensorEntityDescription(
|
||||||
key="max_motion_gates",
|
key="max_motion_gates",
|
||||||
|
translation_key="max_motion_gates",
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
has_entity_name=True,
|
|
||||||
name="Max Motion Gates",
|
|
||||||
native_unit_of_measurement="Gates",
|
native_unit_of_measurement="Gates",
|
||||||
)
|
)
|
||||||
|
|
||||||
MAX_STATIC_GATES_DESCRIPTION = SensorEntityDescription(
|
MAX_STATIC_GATES_DESCRIPTION = SensorEntityDescription(
|
||||||
key="max_static_gates",
|
key="max_static_gates",
|
||||||
|
translation_key="max_static_gates",
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
has_entity_name=True,
|
|
||||||
name="Max Static Gates",
|
|
||||||
native_unit_of_measurement="Gates",
|
native_unit_of_measurement="Gates",
|
||||||
)
|
)
|
||||||
|
|
||||||
MOTION_ENERGY_GATES = [
|
MOTION_ENERGY_GATES = [
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=f"motion_energy_gate_{i}",
|
key=f"motion_energy_gate_{i}",
|
||||||
|
translation_key=f"motion_energy_gate_{i}",
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
has_entity_name=True,
|
|
||||||
name=f"Motion Energy Gate {i}",
|
|
||||||
native_unit_of_measurement="Target Energy",
|
native_unit_of_measurement="Target Energy",
|
||||||
)
|
)
|
||||||
for i in range(0, 9)
|
for i in range(0, 9)
|
||||||
@ -107,10 +99,9 @@ MOTION_ENERGY_GATES = [
|
|||||||
STATIC_ENERGY_GATES = [
|
STATIC_ENERGY_GATES = [
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=f"static_energy_gate_{i}",
|
key=f"static_energy_gate_{i}",
|
||||||
|
translation_key=f"static_energy_gate_{i}",
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
entity_registry_enabled_default=False,
|
entity_registry_enabled_default=False,
|
||||||
has_entity_name=True,
|
|
||||||
name=f"Static Energy Gate {i}",
|
|
||||||
native_unit_of_measurement="Target Energy",
|
native_unit_of_measurement="Target Energy",
|
||||||
)
|
)
|
||||||
for i in range(0, 9)
|
for i in range(0, 9)
|
||||||
@ -152,6 +143,8 @@ async def async_setup_entry(
|
|||||||
class LD2410BLESensor(CoordinatorEntity[LD2410BLECoordinator], SensorEntity):
|
class LD2410BLESensor(CoordinatorEntity[LD2410BLECoordinator], SensorEntity):
|
||||||
"""Generic sensor for LD2410BLE."""
|
"""Generic sensor for LD2410BLE."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
coordinator: LD2410BLECoordinator,
|
coordinator: LD2410BLECoordinator,
|
||||||
|
@ -18,5 +18,84 @@
|
|||||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
|
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
|
||||||
"no_devices_found": "[%key:common::config_flow::abort::no_devices_found%]"
|
"no_devices_found": "[%key:common::config_flow::abort::no_devices_found%]"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"entity": {
|
||||||
|
"sensor": {
|
||||||
|
"moving_target_distance": {
|
||||||
|
"name": "Moving target distance"
|
||||||
|
},
|
||||||
|
"static_target_distance": {
|
||||||
|
"name": "Static target distance"
|
||||||
|
},
|
||||||
|
"detection_distance": {
|
||||||
|
"name": "Detection distance"
|
||||||
|
},
|
||||||
|
"moving_target_energy": {
|
||||||
|
"name": "Moving target energy"
|
||||||
|
},
|
||||||
|
"static_target_energy": {
|
||||||
|
"name": "Static target energy"
|
||||||
|
},
|
||||||
|
"max_motion_gates": {
|
||||||
|
"name": "Max motion gates"
|
||||||
|
},
|
||||||
|
"max_static_gates": {
|
||||||
|
"name": "Max static gates"
|
||||||
|
},
|
||||||
|
"motion_energy_gate_0": {
|
||||||
|
"name": "Motion energy gate 0"
|
||||||
|
},
|
||||||
|
"motion_energy_gate_1": {
|
||||||
|
"name": "Motion energy gate 1"
|
||||||
|
},
|
||||||
|
"motion_energy_gate_2": {
|
||||||
|
"name": "Motion energy gate 2"
|
||||||
|
},
|
||||||
|
"motion_energy_gate_3": {
|
||||||
|
"name": "Motion energy gate 3"
|
||||||
|
},
|
||||||
|
"motion_energy_gate_4": {
|
||||||
|
"name": "Motion energy gate 4"
|
||||||
|
},
|
||||||
|
"motion_energy_gate_5": {
|
||||||
|
"name": "Motion energy gate 5"
|
||||||
|
},
|
||||||
|
"motion_energy_gate_6": {
|
||||||
|
"name": "Motion energy gate 6"
|
||||||
|
},
|
||||||
|
"motion_energy_gate_7": {
|
||||||
|
"name": "Motion energy gate 7"
|
||||||
|
},
|
||||||
|
"motion_energy_gate_8": {
|
||||||
|
"name": "Motion energy gate 8"
|
||||||
|
},
|
||||||
|
"static_energy_gate_0": {
|
||||||
|
"name": "Static energy gate 0"
|
||||||
|
},
|
||||||
|
"static_energy_gate_1": {
|
||||||
|
"name": "Static energy gate 1"
|
||||||
|
},
|
||||||
|
"static_energy_gate_2": {
|
||||||
|
"name": "Static energy gate 2"
|
||||||
|
},
|
||||||
|
"static_energy_gate_3": {
|
||||||
|
"name": "Static energy gate 3"
|
||||||
|
},
|
||||||
|
"static_energy_gate_4": {
|
||||||
|
"name": "Static energy gate 4"
|
||||||
|
},
|
||||||
|
"static_energy_gate_5": {
|
||||||
|
"name": "Static energy gate 5"
|
||||||
|
},
|
||||||
|
"static_energy_gate_6": {
|
||||||
|
"name": "Static energy gate 6"
|
||||||
|
},
|
||||||
|
"static_energy_gate_7": {
|
||||||
|
"name": "Static energy gate 7"
|
||||||
|
},
|
||||||
|
"static_energy_gate_8": {
|
||||||
|
"name": "Static energy gate 8"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user