mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Add entity name translations to sun (#90732)
This commit is contained in:
parent
8f9868024c
commit
da1e5f6a3c
@ -42,48 +42,48 @@ SENSOR_TYPES: tuple[SunSensorEntityDescription, ...] = (
|
|||||||
SunSensorEntityDescription(
|
SunSensorEntityDescription(
|
||||||
key="next_dawn",
|
key="next_dawn",
|
||||||
device_class=SensorDeviceClass.TIMESTAMP,
|
device_class=SensorDeviceClass.TIMESTAMP,
|
||||||
name="Next dawn",
|
translation_key="next_dawn",
|
||||||
icon="mdi:sun-clock",
|
icon="mdi:sun-clock",
|
||||||
value_fn=lambda data: data.next_dawn,
|
value_fn=lambda data: data.next_dawn,
|
||||||
),
|
),
|
||||||
SunSensorEntityDescription(
|
SunSensorEntityDescription(
|
||||||
key="next_dusk",
|
key="next_dusk",
|
||||||
device_class=SensorDeviceClass.TIMESTAMP,
|
device_class=SensorDeviceClass.TIMESTAMP,
|
||||||
name="Next dusk",
|
translation_key="next_dusk",
|
||||||
icon="mdi:sun-clock",
|
icon="mdi:sun-clock",
|
||||||
value_fn=lambda data: data.next_dusk,
|
value_fn=lambda data: data.next_dusk,
|
||||||
),
|
),
|
||||||
SunSensorEntityDescription(
|
SunSensorEntityDescription(
|
||||||
key="next_midnight",
|
key="next_midnight",
|
||||||
device_class=SensorDeviceClass.TIMESTAMP,
|
device_class=SensorDeviceClass.TIMESTAMP,
|
||||||
name="Next midnight",
|
translation_key="next_midnight",
|
||||||
icon="mdi:sun-clock",
|
icon="mdi:sun-clock",
|
||||||
value_fn=lambda data: data.next_midnight,
|
value_fn=lambda data: data.next_midnight,
|
||||||
),
|
),
|
||||||
SunSensorEntityDescription(
|
SunSensorEntityDescription(
|
||||||
key="next_noon",
|
key="next_noon",
|
||||||
device_class=SensorDeviceClass.TIMESTAMP,
|
device_class=SensorDeviceClass.TIMESTAMP,
|
||||||
name="Next noon",
|
translation_key="next_noon",
|
||||||
icon="mdi:sun-clock",
|
icon="mdi:sun-clock",
|
||||||
value_fn=lambda data: data.next_noon,
|
value_fn=lambda data: data.next_noon,
|
||||||
),
|
),
|
||||||
SunSensorEntityDescription(
|
SunSensorEntityDescription(
|
||||||
key="next_rising",
|
key="next_rising",
|
||||||
device_class=SensorDeviceClass.TIMESTAMP,
|
device_class=SensorDeviceClass.TIMESTAMP,
|
||||||
name="Next rising",
|
translation_key="next_rising",
|
||||||
icon="mdi:sun-clock",
|
icon="mdi:sun-clock",
|
||||||
value_fn=lambda data: data.next_rising,
|
value_fn=lambda data: data.next_rising,
|
||||||
),
|
),
|
||||||
SunSensorEntityDescription(
|
SunSensorEntityDescription(
|
||||||
key="next_setting",
|
key="next_setting",
|
||||||
device_class=SensorDeviceClass.TIMESTAMP,
|
device_class=SensorDeviceClass.TIMESTAMP,
|
||||||
name="Next setting",
|
translation_key="next_setting",
|
||||||
icon="mdi:sun-clock",
|
icon="mdi:sun-clock",
|
||||||
value_fn=lambda data: data.next_setting,
|
value_fn=lambda data: data.next_setting,
|
||||||
),
|
),
|
||||||
SunSensorEntityDescription(
|
SunSensorEntityDescription(
|
||||||
key="solar_elevation",
|
key="solar_elevation",
|
||||||
name="Solar elevation",
|
translation_key="solar_elevation",
|
||||||
icon="mdi:theme-light-dark",
|
icon="mdi:theme-light-dark",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
value_fn=lambda data: data.solar_elevation,
|
value_fn=lambda data: data.solar_elevation,
|
||||||
@ -92,7 +92,7 @@ SENSOR_TYPES: tuple[SunSensorEntityDescription, ...] = (
|
|||||||
),
|
),
|
||||||
SunSensorEntityDescription(
|
SunSensorEntityDescription(
|
||||||
key="solar_azimuth",
|
key="solar_azimuth",
|
||||||
name="Solar azimuth",
|
translation_key="solar_azimuth",
|
||||||
icon="mdi:sun-angle",
|
icon="mdi:sun-angle",
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
value_fn=lambda data: data.solar_azimuth,
|
value_fn=lambda data: data.solar_azimuth,
|
||||||
@ -117,6 +117,7 @@ async def async_setup_entry(
|
|||||||
class SunSensor(SensorEntity):
|
class SunSensor(SensorEntity):
|
||||||
"""Representation of a Sun Sensor."""
|
"""Representation of a Sun Sensor."""
|
||||||
|
|
||||||
|
_attr_has_entity_name = True
|
||||||
entity_description: SunSensorEntityDescription
|
entity_description: SunSensorEntityDescription
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
@ -18,5 +18,17 @@
|
|||||||
"below_horizon": "Below horizon"
|
"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" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user