Add entity name translations for devolo Home Network (#90471)

This commit is contained in:
Guido Schmitz 2023-03-29 23:25:33 +02:00 committed by GitHub
parent 3bebd4318e
commit 706e6597d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 6 deletions

View file

@ -53,7 +53,6 @@ SENSOR_TYPES: dict[str, DevoloBinarySensorEntityDescription] = {
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
icon="mdi:router-network",
name="Connected to router",
value_func=_is_connected_to_router,
),
}

View file

@ -57,4 +57,5 @@ class DevoloEntity(CoordinatorEntity[DataUpdateCoordinator[_DataT]]):
name=entry.title,
sw_version=device.firmware_version,
)
self._attr_translation_key = self.entity_description.key
self._attr_unique_id = f"{device.serial_number}_{self.entity_description.key}"

View file

@ -54,7 +54,6 @@ SENSOR_TYPES: dict[str, DevoloSensorEntityDescription[Any]] = {
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
icon="mdi:lan",
name="Connected PLC devices",
value_func=lambda data: len(
{device.mac_address_from for device in data.data_rates}
),
@ -62,7 +61,6 @@ SENSOR_TYPES: dict[str, DevoloSensorEntityDescription[Any]] = {
CONNECTED_WIFI_CLIENTS: DevoloSensorEntityDescription[list[ConnectedStationInfo]](
key=CONNECTED_WIFI_CLIENTS,
icon="mdi:wifi",
name="Connected Wifi clients",
state_class=SensorStateClass.MEASUREMENT,
value_func=len,
),
@ -71,7 +69,6 @@ SENSOR_TYPES: dict[str, DevoloSensorEntityDescription[Any]] = {
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
icon="mdi:wifi-marker",
name="Neighboring Wifi networks",
value_func=len,
),
}

View file

@ -27,5 +27,31 @@
"home_control": "The devolo Home Control Central Unit does not work with this integration.",
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]"
}
},
"entity": {
"binary_sensor": {
"connected_to_router": {
"name": "Connected to router"
}
},
"sensor": {
"connected_plc_devices": {
"name": "Connected PLC devices"
},
"connected_wifi_clients": {
"name": "Connected Wifi clients"
},
"neighboring_wifi_networks": {
"name": "Neighboring Wifi networks"
}
},
"switch": {
"switch_guest_wifi": {
"name": "Enable guest Wifi"
},
"switch_leds": {
"name": "Enable LEDs"
}
}
}
}

View file

@ -42,7 +42,6 @@ SWITCH_TYPES: dict[str, DevoloSwitchEntityDescription[Any]] = {
SWITCH_GUEST_WIFI: DevoloSwitchEntityDescription[WifiGuestAccessGet](
key=SWITCH_GUEST_WIFI,
icon="mdi:wifi",
name="Enable guest Wifi",
is_on_func=lambda data: data.enabled is True,
turn_on_func=lambda device: device.device.async_set_wifi_guest_access(True), # type: ignore[union-attr]
turn_off_func=lambda device: device.device.async_set_wifi_guest_access(False), # type: ignore[union-attr]
@ -51,7 +50,6 @@ SWITCH_TYPES: dict[str, DevoloSwitchEntityDescription[Any]] = {
key=SWITCH_LEDS,
entity_category=EntityCategory.CONFIG,
icon="mdi:led-off",
name="Enable LEDs",
is_on_func=bool,
turn_on_func=lambda device: device.device.async_set_led_setting(True), # type: ignore[union-attr]
turn_off_func=lambda device: device.device.async_set_led_setting(False), # type: ignore[union-attr]