diff --git a/homeassistant/components/sun/sensor.py b/homeassistant/components/sun/sensor.py index 8a253566e20..8a390ea2a27 100644 --- a/homeassistant/components/sun/sensor.py +++ b/homeassistant/components/sun/sensor.py @@ -42,48 +42,48 @@ SENSOR_TYPES: tuple[SunSensorEntityDescription, ...] = ( SunSensorEntityDescription( key="next_dawn", device_class=SensorDeviceClass.TIMESTAMP, - name="Next dawn", + translation_key="next_dawn", icon="mdi:sun-clock", value_fn=lambda data: data.next_dawn, ), SunSensorEntityDescription( key="next_dusk", device_class=SensorDeviceClass.TIMESTAMP, - name="Next dusk", + translation_key="next_dusk", icon="mdi:sun-clock", value_fn=lambda data: data.next_dusk, ), SunSensorEntityDescription( key="next_midnight", device_class=SensorDeviceClass.TIMESTAMP, - name="Next midnight", + translation_key="next_midnight", icon="mdi:sun-clock", value_fn=lambda data: data.next_midnight, ), SunSensorEntityDescription( key="next_noon", device_class=SensorDeviceClass.TIMESTAMP, - name="Next noon", + translation_key="next_noon", icon="mdi:sun-clock", value_fn=lambda data: data.next_noon, ), SunSensorEntityDescription( key="next_rising", device_class=SensorDeviceClass.TIMESTAMP, - name="Next rising", + translation_key="next_rising", icon="mdi:sun-clock", value_fn=lambda data: data.next_rising, ), SunSensorEntityDescription( key="next_setting", device_class=SensorDeviceClass.TIMESTAMP, - name="Next setting", + translation_key="next_setting", icon="mdi:sun-clock", value_fn=lambda data: data.next_setting, ), SunSensorEntityDescription( key="solar_elevation", - name="Solar elevation", + translation_key="solar_elevation", icon="mdi:theme-light-dark", state_class=SensorStateClass.MEASUREMENT, value_fn=lambda data: data.solar_elevation, @@ -92,7 +92,7 @@ SENSOR_TYPES: tuple[SunSensorEntityDescription, ...] = ( ), SunSensorEntityDescription( key="solar_azimuth", - name="Solar azimuth", + translation_key="solar_azimuth", icon="mdi:sun-angle", state_class=SensorStateClass.MEASUREMENT, value_fn=lambda data: data.solar_azimuth, @@ -117,6 +117,7 @@ async def async_setup_entry( class SunSensor(SensorEntity): """Representation of a Sun Sensor.""" + _attr_has_entity_name = True entity_description: SunSensorEntityDescription def __init__( diff --git a/homeassistant/components/sun/strings.json b/homeassistant/components/sun/strings.json index 9a49a061c1f..3d0374f1de0 100644 --- a/homeassistant/components/sun/strings.json +++ b/homeassistant/components/sun/strings.json @@ -18,5 +18,17 @@ "below_horizon": "Below horizon" } } + }, + "entity": { + "sensor": { + "next_dawn": { "name": "Next dawn" }, + "next_dusk": { "name": "Next dusk" }, + "next_midnight": { "name": "Next midnight" }, + "next_noon": { "name": "Next noon" }, + "next_rising": { "name": "Next rising" }, + "next_setting": { "name": "Next setting" }, + "solar_azimuth": { "name": "Solar azimuth" }, + "solar_elevation": { "name": "Solar elevation" } + } } }