Add entity translations to Yalexs BLE (#96827)

pull/96830/head
Joost Lekkerkerker 2023-07-18 11:04:24 +02:00 committed by GitHub
parent 0134ee9305
commit d361caf6c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 9 additions and 5 deletions

View File

@ -32,7 +32,6 @@ class YaleXSBLEDoorSensor(YALEXSBLEEntity, BinarySensorEntity):
"""Yale XS BLE binary sensor."""
_attr_device_class = BinarySensorDeviceClass.DOOR
_attr_has_entity_name = True
@callback
def _async_update_state(

View File

@ -15,6 +15,7 @@ from .models import YaleXSBLEData
class YALEXSBLEEntity(Entity):
"""Base class for yale xs ble entities."""
_attr_has_entity_name = True
_attr_should_poll = False
def __init__(self, data: YaleXSBLEData) -> None:

View File

@ -28,7 +28,6 @@ async def async_setup_entry(
class YaleXSBLELock(YALEXSBLEEntity, LockEntity):
"""A yale xs ble lock."""
_attr_has_entity_name = True
_attr_name = None
@callback

View File

@ -44,7 +44,6 @@ class YaleXSBLESensorEntityDescription(
SENSORS: tuple[YaleXSBLESensorEntityDescription, ...] = (
YaleXSBLESensorEntityDescription(
key="", # No key for the original RSSI sensor unique id
name="Signal strength",
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT,
@ -55,7 +54,6 @@ SENSORS: tuple[YaleXSBLESensorEntityDescription, ...] = (
),
YaleXSBLESensorEntityDescription(
key="battery_level",
name="Battery level",
device_class=SensorDeviceClass.BATTERY,
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT,
@ -67,7 +65,7 @@ SENSORS: tuple[YaleXSBLESensorEntityDescription, ...] = (
),
YaleXSBLESensorEntityDescription(
key="battery_voltage",
name="Battery Voltage",
translation_key="battery_voltage",
device_class=SensorDeviceClass.VOLTAGE,
entity_category=EntityCategory.DIAGNOSTIC,
state_class=SensorStateClass.MEASUREMENT,

View File

@ -45,5 +45,12 @@
}
}
}
},
"entity": {
"sensor": {
"battery_voltage": {
"name": "Battery voltage"
}
}
}
}