diff --git a/homeassistant/components/sms/sensor.py b/homeassistant/components/sms/sensor.py index d72bda048bb..cfa31d56e80 100644 --- a/homeassistant/components/sms/sensor.py +++ b/homeassistant/components/sms/sensor.py @@ -17,7 +17,7 @@ from .const import DOMAIN, GATEWAY, NETWORK_COORDINATOR, SIGNAL_COORDINATOR, SMS SIGNAL_SENSORS = ( SensorEntityDescription( key="SignalStrength", - name="Signal Strength", + translation_key="signal_strength", device_class=SensorDeviceClass.SIGNAL_STRENGTH, entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS, @@ -27,14 +27,14 @@ SIGNAL_SENSORS = ( SensorEntityDescription( key="SignalPercent", icon="mdi:signal-cellular-3", - name="Signal Percent", + translation_key="signal_percent", native_unit_of_measurement=PERCENTAGE, entity_registry_enabled_default=True, state_class=SensorStateClass.MEASUREMENT, ), SensorEntityDescription( key="BitErrorRate", - name="Bit Error Rate", + translation_key="bit_error_rate", entity_category=EntityCategory.DIAGNOSTIC, native_unit_of_measurement=PERCENTAGE, entity_registry_enabled_default=False, @@ -45,31 +45,31 @@ SIGNAL_SENSORS = ( NETWORK_SENSORS = ( SensorEntityDescription( key="NetworkName", - name="Network Name", + translation_key="network_name", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), SensorEntityDescription( key="State", - name="Network Status", + translation_key="state", entity_registry_enabled_default=True, ), SensorEntityDescription( key="NetworkCode", - name="GSM network code", + translation_key="network_code", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), SensorEntityDescription( key="CID", - name="Cell ID", + translation_key="cid", icon="mdi:radio-tower", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), SensorEntityDescription( key="LAC", - name="Local Area Code", + translation_key="lac", entity_category=EntityCategory.DIAGNOSTIC, entity_registry_enabled_default=False, ), @@ -102,6 +102,8 @@ async def async_setup_entry( class DeviceSensor(CoordinatorEntity, SensorEntity): """Implementation of a device sensor.""" + _attr_has_entity_name = True + def __init__(self, coordinator, description, unique_id, gateway): """Initialize the device sensor.""" super().__init__(coordinator) diff --git a/homeassistant/components/sms/strings.json b/homeassistant/components/sms/strings.json index b4a9279845d..6bf8cbcc166 100644 --- a/homeassistant/components/sms/strings.json +++ b/homeassistant/components/sms/strings.json @@ -17,5 +17,19 @@ "already_configured": "[%key:common::config_flow::abort::already_configured_device%]", "single_instance_allowed": "[%key:common::config_flow::abort::single_instance_allowed%]" } + }, + "entity": { + "sensor": { + "bit_error_rate": { "name": "Bit error rate" }, + "cid": { "name": "Cell ID" }, + "lac": { "name": "Local area code" }, + "network_code": { "name": "GSM network code" }, + "network_name": { "name": "Network name" }, + "signal_percent": { "name": "Signal percent" }, + "signal_strength": { + "name": "[%key:component::sensor::entity_component::signal_strength::name%]" + }, + "state": { "name": "Network status" } + } } }