From 7ea2087c452e51c5ce290a03a473984ef7f023a3 Mon Sep 17 00:00:00 2001 From: starkillerOG Date: Thu, 14 Sep 2023 13:58:53 +0200 Subject: [PATCH] Add Netgear entity translations (#100367) Co-authored-by: Joost Lekkerkerker --- homeassistant/components/netgear/sensor.py | 54 ++++----- homeassistant/components/netgear/strings.json | 111 ++++++++++++++++++ homeassistant/components/netgear/switch.py | 16 +-- 3 files changed, 146 insertions(+), 35 deletions(-) diff --git a/homeassistant/components/netgear/sensor.py b/homeassistant/components/netgear/sensor.py index 0de98515a878c..6e7771d44cb96 100644 --- a/homeassistant/components/netgear/sensor.py +++ b/homeassistant/components/netgear/sensor.py @@ -44,33 +44,33 @@ SENSOR_TYPES = { "type": SensorEntityDescription( key="type", - name="link type", + translation_key="link_type", entity_category=EntityCategory.DIAGNOSTIC, icon="mdi:lan", ), "link_rate": SensorEntityDescription( key="link_rate", - name="link rate", + translation_key="link_rate", native_unit_of_measurement="Mbps", entity_category=EntityCategory.DIAGNOSTIC, icon="mdi:speedometer", ), "signal": SensorEntityDescription( key="signal", - name="signal strength", + translation_key="signal_strength", native_unit_of_measurement=PERCENTAGE, entity_category=EntityCategory.DIAGNOSTIC, icon="mdi:wifi", ), "ssid": SensorEntityDescription( key="ssid", - name="ssid", + translation_key="ssid", entity_category=EntityCategory.DIAGNOSTIC, icon="mdi:wifi-marker", ), "conn_ap_mac": SensorEntityDescription( key="conn_ap_mac", - name="access point mac", + translation_key="access_point_mac", entity_category=EntityCategory.DIAGNOSTIC, icon="mdi:router-network", ), @@ -88,7 +88,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): SENSOR_TRAFFIC_TYPES = [ NetgearSensorEntityDescription( key="NewTodayUpload", - name="Upload today", + translation_key="upload_today", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -96,7 +96,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewTodayDownload", - name="Download today", + translation_key="download_today", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -104,7 +104,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewYesterdayUpload", - name="Upload yesterday", + translation_key="upload_yesterday", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -112,7 +112,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewYesterdayDownload", - name="Download yesterday", + translation_key="download_yesterday", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -120,7 +120,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewWeekUpload", - name="Upload week", + translation_key="upload_week", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -130,7 +130,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewWeekUpload", - name="Upload week average", + translation_key="upload_week_average", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -140,7 +140,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewWeekDownload", - name="Download week", + translation_key="download_week", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -150,7 +150,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewWeekDownload", - name="Download week average", + translation_key="download_week_average", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -160,7 +160,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewMonthUpload", - name="Upload month", + translation_key="upload_month", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -170,7 +170,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewMonthUpload", - name="Upload month average", + translation_key="upload_month_average", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -180,7 +180,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewMonthDownload", - name="Download month", + translation_key="download_month", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -190,7 +190,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewMonthDownload", - name="Download month average", + translation_key="download_month_average", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -200,7 +200,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewLastMonthUpload", - name="Upload last month", + translation_key="upload_last_month", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -210,7 +210,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewLastMonthUpload", - name="Upload last month average", + translation_key="upload_last_month_average", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -220,7 +220,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewLastMonthDownload", - name="Download last month", + translation_key="download_last_month", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -230,7 +230,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewLastMonthDownload", - name="Download last month average", + translation_key="download_last_month_average", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfInformation.MEGABYTES, device_class=SensorDeviceClass.DATA_SIZE, @@ -243,7 +243,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): SENSOR_SPEED_TYPES = [ NetgearSensorEntityDescription( key="NewOOKLAUplinkBandwidth", - name="Uplink Bandwidth", + translation_key="uplink_bandwidth", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfDataRate.MEGABITS_PER_SECOND, device_class=SensorDeviceClass.DATA_RATE, @@ -251,7 +251,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewOOKLADownlinkBandwidth", - name="Downlink Bandwidth", + translation_key="downlink_bandwidth", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfDataRate.MEGABITS_PER_SECOND, device_class=SensorDeviceClass.DATA_RATE, @@ -259,7 +259,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="AveragePing", - name="Average Ping", + translation_key="average_ping", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=UnitOfTime.MILLISECONDS, icon="mdi:wan", @@ -269,7 +269,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): SENSOR_UTILIZATION = [ NetgearSensorEntityDescription( key="NewCPUUtilization", - name="CPU Utilization", + translation_key="cpu_utilization", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=PERCENTAGE, icon="mdi:cpu-64-bit", @@ -277,7 +277,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): ), NetgearSensorEntityDescription( key="NewMemoryUtilization", - name="Memory Utilization", + translation_key="memory_utilization", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=PERCENTAGE, icon="mdi:memory", @@ -288,7 +288,7 @@ class NetgearSensorEntityDescription(SensorEntityDescription): SENSOR_LINK_TYPES = [ NetgearSensorEntityDescription( key="NewEthernetLinkStatus", - name="Ethernet Link Status", + translation_key="ethernet_link_status", entity_category=EntityCategory.DIAGNOSTIC, icon="mdi:ethernet", ), diff --git a/homeassistant/components/netgear/strings.json b/homeassistant/components/netgear/strings.json index a903535d5a878..6b4883b8ce31f 100644 --- a/homeassistant/components/netgear/strings.json +++ b/homeassistant/components/netgear/strings.json @@ -29,5 +29,116 @@ } } } + }, + "entity": { + "sensor": { + "link_type": { + "name": "Link type" + }, + "link_rate": { + "name": "Link rate" + }, + "signal_strength": { + "name": "[%key:component::sensor::entity_component::signal_strength::name%]" + }, + "ssid": { + "name": "SSID" + }, + "access_point_mac": { + "name": "Access point mac" + }, + "upload_today": { + "name": "Upload today" + }, + "download_today": { + "name": "Download today" + }, + "upload_yesterday": { + "name": "Upload yesterday" + }, + "download_yesterday": { + "name": "Download yesterday" + }, + "upload_week": { + "name": "Upload this week" + }, + "upload_week_average": { + "name": "Upload this week average" + }, + "download_week": { + "name": "Download this week" + }, + "download_week_average": { + "name": "Download this week average" + }, + "upload_month": { + "name": "Upload this month" + }, + "upload_month_average": { + "name": "Upload this month average" + }, + "download_month": { + "name": "Download this month" + }, + "download_month_average": { + "name": "Download this month average" + }, + "upload_last_month": { + "name": "Upload last month" + }, + "upload_last_month_average": { + "name": "Upload last month average" + }, + "download_last_month": { + "name": "Download last month" + }, + "download_last_month_average": { + "name": "Download last month average" + }, + "uplink_bandwidth": { + "name": "Uplink bandwidth" + }, + "downlink_bandwidth": { + "name": "Downlink bandwidth" + }, + "average_ping": { + "name": "Average ping" + }, + "cpu_utilization": { + "name": "CPU utilization" + }, + "memory_utilization": { + "name": "Memory utilization" + }, + "ethernet_link_status": { + "name": "Ethernet link status" + } + }, + "switch": { + "allowed_on_network": { + "name": "Allowed on network" + }, + "access_control": { + "name": "Access control" + }, + "traffic_meter": { + "name": "Traffic meter" + }, + "parental_control": { + "name": "Parental control" + }, + "quality_of_service": { + "name": "Quality of service" + }, + "2g_guest_wifi": { + "name": "2.4GHz guest Wi-Fi" + }, + "5g_guest_wifi": { + "name": "5GHz guest Wi-Fi" + }, + "smart_connect": { + "name": "Smart connect" + } + } } } diff --git a/homeassistant/components/netgear/switch.py b/homeassistant/components/netgear/switch.py index f594506cbfbc4..a4548da16a4c5 100644 --- a/homeassistant/components/netgear/switch.py +++ b/homeassistant/components/netgear/switch.py @@ -25,7 +25,7 @@ SWITCH_TYPES = [ SwitchEntityDescription( key="allow_or_block", - name="Allowed on network", + translation_key="allowed_on_network", icon="mdi:block-helper", entity_category=EntityCategory.CONFIG, ) @@ -50,7 +50,7 @@ class NetgearSwitchEntityDescription( ROUTER_SWITCH_TYPES = [ NetgearSwitchEntityDescription( key="access_control", - name="Access Control", + translation_key="access_control", icon="mdi:block-helper", entity_category=EntityCategory.CONFIG, update=lambda router: router.api.get_block_device_enable_status, @@ -58,7 +58,7 @@ class NetgearSwitchEntityDescription( ), NetgearSwitchEntityDescription( key="traffic_meter", - name="Traffic Meter", + translation_key="traffic_meter", icon="mdi:wifi-arrow-up-down", entity_category=EntityCategory.CONFIG, update=lambda router: router.api.get_traffic_meter_enabled, @@ -66,7 +66,7 @@ class NetgearSwitchEntityDescription( ), NetgearSwitchEntityDescription( key="parental_control", - name="Parental Control", + translation_key="parental_control", icon="mdi:account-child-outline", entity_category=EntityCategory.CONFIG, update=lambda router: router.api.get_parental_control_enable_status, @@ -74,7 +74,7 @@ class NetgearSwitchEntityDescription( ), NetgearSwitchEntityDescription( key="qos", - name="Quality of Service", + translation_key="quality_of_service", icon="mdi:wifi-star", entity_category=EntityCategory.CONFIG, update=lambda router: router.api.get_qos_enable_status, @@ -82,7 +82,7 @@ class NetgearSwitchEntityDescription( ), NetgearSwitchEntityDescription( key="2g_guest_wifi", - name="2.4G Guest Wifi", + translation_key="2g_guest_wifi", icon="mdi:wifi", entity_category=EntityCategory.CONFIG, update=lambda router: router.api.get_2g_guest_access_enabled, @@ -90,7 +90,7 @@ class NetgearSwitchEntityDescription( ), NetgearSwitchEntityDescription( key="5g_guest_wifi", - name="5G Guest Wifi", + translation_key="5g_guest_wifi", icon="mdi:wifi", entity_category=EntityCategory.CONFIG, update=lambda router: router.api.get_5g_guest_access_enabled, @@ -98,7 +98,7 @@ class NetgearSwitchEntityDescription( ), NetgearSwitchEntityDescription( key="smart_connect", - name="Smart Connect", + translation_key="smart_connect", icon="mdi:wifi", entity_category=EntityCategory.CONFIG, update=lambda router: router.api.get_smart_connect_enabled,