From ba1bf9d39fdf49b149332a1e63f8a9d9b1c132dd Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Mon, 24 Jul 2023 20:29:23 +0200 Subject: [PATCH] Add entity translations to AsusWRT (#95125) --- homeassistant/components/asuswrt/sensor.py | 22 +++++------ homeassistant/components/asuswrt/strings.json | 39 ++++++++++++++++++- 2 files changed, 49 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/asuswrt/sensor.py b/homeassistant/components/asuswrt/sensor.py index 7f54bc29393..4f9ec0af411 100644 --- a/homeassistant/components/asuswrt/sensor.py +++ b/homeassistant/components/asuswrt/sensor.py @@ -50,14 +50,14 @@ UNIT_DEVICES = "Devices" CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = ( AsusWrtSensorEntityDescription( key=SENSORS_CONNECTED_DEVICE[0], - name="Devices Connected", + translation_key="devices_connected", icon="mdi:router-network", state_class=SensorStateClass.MEASUREMENT, native_unit_of_measurement=UNIT_DEVICES, ), AsusWrtSensorEntityDescription( key=SENSORS_RATES[0], - name="Download Speed", + translation_key="download_speed", icon="mdi:download-network", device_class=SensorDeviceClass.DATA_RATE, state_class=SensorStateClass.MEASUREMENT, @@ -68,7 +68,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = ( ), AsusWrtSensorEntityDescription( key=SENSORS_RATES[1], - name="Upload Speed", + translation_key="upload_speed", icon="mdi:upload-network", device_class=SensorDeviceClass.DATA_RATE, state_class=SensorStateClass.MEASUREMENT, @@ -79,7 +79,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = ( ), AsusWrtSensorEntityDescription( key=SENSORS_BYTES[0], - name="Download", + translation_key="download", icon="mdi:download", state_class=SensorStateClass.TOTAL_INCREASING, native_unit_of_measurement=UnitOfInformation.GIGABYTES, @@ -90,7 +90,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = ( ), AsusWrtSensorEntityDescription( key=SENSORS_BYTES[1], - name="Upload", + translation_key="upload", icon="mdi:upload", state_class=SensorStateClass.TOTAL_INCREASING, native_unit_of_measurement=UnitOfInformation.GIGABYTES, @@ -101,7 +101,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = ( ), AsusWrtSensorEntityDescription( key=SENSORS_LOAD_AVG[0], - name="Load Avg (1m)", + translation_key="load_avg_1m", icon="mdi:cpu-32-bit", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -110,7 +110,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = ( ), AsusWrtSensorEntityDescription( key=SENSORS_LOAD_AVG[1], - name="Load Avg (5m)", + translation_key="load_avg_5m", icon="mdi:cpu-32-bit", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -119,7 +119,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = ( ), AsusWrtSensorEntityDescription( key=SENSORS_LOAD_AVG[2], - name="Load Avg (15m)", + translation_key="load_avg_15m", icon="mdi:cpu-32-bit", state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, @@ -128,7 +128,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = ( ), AsusWrtSensorEntityDescription( key=SENSORS_TEMPERATURES[0], - name="2.4GHz Temperature", + translation_key="24ghz_temperature", state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -138,7 +138,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = ( ), AsusWrtSensorEntityDescription( key=SENSORS_TEMPERATURES[1], - name="5GHz Temperature", + translation_key="5ghz_temperature", state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, @@ -148,7 +148,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = ( ), AsusWrtSensorEntityDescription( key=SENSORS_TEMPERATURES[2], - name="CPU Temperature", + translation_key="cpu_temperature", state_class=SensorStateClass.MEASUREMENT, device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=UnitOfTemperature.CELSIUS, diff --git a/homeassistant/components/asuswrt/strings.json b/homeassistant/components/asuswrt/strings.json index f6ccb5a7c9c..52b9f919434 100644 --- a/homeassistant/components/asuswrt/strings.json +++ b/homeassistant/components/asuswrt/strings.json @@ -36,11 +36,48 @@ "data": { "consider_home": "Seconds to wait before considering a device away", "track_unknown": "Track unknown / unnamed devices", - "interface": "The interface that you want statistics from (e.g. eth0,eth1 etc)", + "interface": "The interface that you want statistics from (e.g. eth0, eth1 etc)", "dnsmasq": "The location in the router of the dnsmasq.leases files", "require_ip": "Devices must have IP (for access point mode)" } } } + }, + "entity": { + "sensor": { + "devices_connected": { + "name": "Devices connected" + }, + "download_speed": { + "name": "Download speed" + }, + "upload_speed": { + "name": "Upload speed" + }, + "download": { + "name": "Download" + }, + "upload": { + "name": "Upload" + }, + "load_avg_1m": { + "name": "Average load (1m)" + }, + "load_avg_5m": { + "name": "Average load (5m)" + }, + "load_avg_15m": { + "name": "Average load (15m)" + }, + "24ghz_temperature": { + "name": "2.4GHz Temperature" + }, + "5ghz_temperature": { + "name": "5GHz Temperature" + }, + "cpu_temperature": { + "name": "CPU Temperature" + } + } } }