mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Add entity translations to Blink (#95138)
This commit is contained in:
parent
07936884a3
commit
36ded01264
@ -41,6 +41,7 @@ class BlinkSyncModule(AlarmControlPanelEntity):
|
||||
|
||||
_attr_icon = ICON
|
||||
_attr_supported_features = AlarmControlPanelEntityFeature.ARM_AWAY
|
||||
_attr_name = None
|
||||
|
||||
def __init__(self, data, name, sync):
|
||||
"""Initialize the alarm control panel."""
|
||||
@ -48,9 +49,10 @@ class BlinkSyncModule(AlarmControlPanelEntity):
|
||||
self.sync = sync
|
||||
self._name = name
|
||||
self._attr_unique_id = sync.serial
|
||||
self._attr_name = f"{DOMAIN} {name}"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, sync.serial)}, name=name, manufacturer=DEFAULT_BRAND
|
||||
identifiers={(DOMAIN, sync.serial)},
|
||||
name=f"{DOMAIN} {name}",
|
||||
manufacturer=DEFAULT_BRAND,
|
||||
)
|
||||
|
||||
def update(self) -> None:
|
||||
|
@ -27,17 +27,15 @@ _LOGGER = logging.getLogger(__name__)
|
||||
BINARY_SENSORS_TYPES: tuple[BinarySensorEntityDescription, ...] = (
|
||||
BinarySensorEntityDescription(
|
||||
key=TYPE_BATTERY,
|
||||
name="Battery",
|
||||
device_class=BinarySensorDeviceClass.BATTERY,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
BinarySensorEntityDescription(
|
||||
key=TYPE_CAMERA_ARMED,
|
||||
name="Camera Armed",
|
||||
translation_key="camera_armed",
|
||||
),
|
||||
BinarySensorEntityDescription(
|
||||
key=TYPE_MOTION_DETECTED,
|
||||
name="Motion Detected",
|
||||
device_class=BinarySensorDeviceClass.MOTION,
|
||||
),
|
||||
)
|
||||
|
@ -38,11 +38,12 @@ async def async_setup_entry(
|
||||
class BlinkCamera(Camera):
|
||||
"""An implementation of a Blink Camera."""
|
||||
|
||||
_attr_name = None
|
||||
|
||||
def __init__(self, data, name, camera):
|
||||
"""Initialize a camera."""
|
||||
super().__init__()
|
||||
self.data = data
|
||||
self._attr_name = f"{DOMAIN} {name}"
|
||||
self._camera = camera
|
||||
self._attr_unique_id = f"{camera.serial}-camera"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
|
@ -25,14 +25,13 @@ _LOGGER = logging.getLogger(__name__)
|
||||
SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
||||
SensorEntityDescription(
|
||||
key=TYPE_TEMPERATURE,
|
||||
name="Temperature",
|
||||
native_unit_of_measurement=UnitOfTemperature.FAHRENHEIT,
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
),
|
||||
SensorEntityDescription(
|
||||
key=TYPE_WIFI_STRENGTH,
|
||||
name="Wifi Signal",
|
||||
translation_key="wifi_rssi",
|
||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
@ -57,10 +56,11 @@ async def async_setup_entry(
|
||||
class BlinkSensor(SensorEntity):
|
||||
"""A Blink camera sensor."""
|
||||
|
||||
_attr_has_entity_name = True
|
||||
|
||||
def __init__(self, data, camera, description: SensorEntityDescription) -> None:
|
||||
"""Initialize sensors from Blink camera."""
|
||||
self.entity_description = description
|
||||
self._attr_name = f"{DOMAIN} {camera} {description.name}"
|
||||
self.data = data
|
||||
self._camera = data.cameras[camera]
|
||||
self._attr_unique_id = f"{self._camera.serial}-{description.key}"
|
||||
@ -71,7 +71,7 @@ class BlinkSensor(SensorEntity):
|
||||
)
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={(DOMAIN, self._camera.serial)},
|
||||
name=camera,
|
||||
name=f"{DOMAIN} {camera}",
|
||||
manufacturer=DEFAULT_BRAND,
|
||||
model=self._camera.camera_type,
|
||||
)
|
||||
|
@ -34,5 +34,17 @@
|
||||
"description": "Configure Blink integration"
|
||||
}
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"wifi_rssi": {
|
||||
"name": "Wi-Fi RSSI"
|
||||
}
|
||||
},
|
||||
"binary_sensor": {
|
||||
"camera_armed": {
|
||||
"name": "Camera armed"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user