Add entity translations to Yalexs BLE (#96827)
parent
0134ee9305
commit
d361caf6c4
|
@ -32,7 +32,6 @@ class YaleXSBLEDoorSensor(YALEXSBLEEntity, BinarySensorEntity):
|
||||||
"""Yale XS BLE binary sensor."""
|
"""Yale XS BLE binary sensor."""
|
||||||
|
|
||||||
_attr_device_class = BinarySensorDeviceClass.DOOR
|
_attr_device_class = BinarySensorDeviceClass.DOOR
|
||||||
_attr_has_entity_name = True
|
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
def _async_update_state(
|
def _async_update_state(
|
||||||
|
|
|
@ -15,6 +15,7 @@ from .models import YaleXSBLEData
|
||||||
class YALEXSBLEEntity(Entity):
|
class YALEXSBLEEntity(Entity):
|
||||||
"""Base class for yale xs ble entities."""
|
"""Base class for yale xs ble entities."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
_attr_should_poll = False
|
_attr_should_poll = False
|
||||||
|
|
||||||
def __init__(self, data: YaleXSBLEData) -> None:
|
def __init__(self, data: YaleXSBLEData) -> None:
|
||||||
|
|
|
@ -28,7 +28,6 @@ async def async_setup_entry(
|
||||||
class YaleXSBLELock(YALEXSBLEEntity, LockEntity):
|
class YaleXSBLELock(YALEXSBLEEntity, LockEntity):
|
||||||
"""A yale xs ble lock."""
|
"""A yale xs ble lock."""
|
||||||
|
|
||||||
_attr_has_entity_name = True
|
|
||||||
_attr_name = None
|
_attr_name = None
|
||||||
|
|
||||||
@callback
|
@callback
|
||||||
|
|
|
@ -44,7 +44,6 @@ class YaleXSBLESensorEntityDescription(
|
||||||
SENSORS: tuple[YaleXSBLESensorEntityDescription, ...] = (
|
SENSORS: tuple[YaleXSBLESensorEntityDescription, ...] = (
|
||||||
YaleXSBLESensorEntityDescription(
|
YaleXSBLESensorEntityDescription(
|
||||||
key="", # No key for the original RSSI sensor unique id
|
key="", # No key for the original RSSI sensor unique id
|
||||||
name="Signal strength",
|
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
@ -55,7 +54,6 @@ SENSORS: tuple[YaleXSBLESensorEntityDescription, ...] = (
|
||||||
),
|
),
|
||||||
YaleXSBLESensorEntityDescription(
|
YaleXSBLESensorEntityDescription(
|
||||||
key="battery_level",
|
key="battery_level",
|
||||||
name="Battery level",
|
|
||||||
device_class=SensorDeviceClass.BATTERY,
|
device_class=SensorDeviceClass.BATTERY,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
@ -67,7 +65,7 @@ SENSORS: tuple[YaleXSBLESensorEntityDescription, ...] = (
|
||||||
),
|
),
|
||||||
YaleXSBLESensorEntityDescription(
|
YaleXSBLESensorEntityDescription(
|
||||||
key="battery_voltage",
|
key="battery_voltage",
|
||||||
name="Battery Voltage",
|
translation_key="battery_voltage",
|
||||||
device_class=SensorDeviceClass.VOLTAGE,
|
device_class=SensorDeviceClass.VOLTAGE,
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
|
|
@ -45,5 +45,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"entity": {
|
||||||
|
"sensor": {
|
||||||
|
"battery_voltage": {
|
||||||
|
"name": "Battery voltage"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue