mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Add entity translations for Meater (#95732)
* Add entity translations for Meater * Update homeassistant/components/meater/sensor.py --------- Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io> Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
parent
4551954c85
commit
792525b7a2
@ -64,8 +64,8 @@ SENSOR_TYPES = (
|
||||
# Ambient temperature
|
||||
MeaterSensorEntityDescription(
|
||||
key="ambient",
|
||||
translation_key="ambient",
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
name="Ambient",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
available=lambda probe: probe is not None,
|
||||
@ -74,8 +74,8 @@ SENSOR_TYPES = (
|
||||
# Internal temperature (probe tip)
|
||||
MeaterSensorEntityDescription(
|
||||
key="internal",
|
||||
translation_key="internal",
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
name="Internal",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
available=lambda probe: probe is not None,
|
||||
@ -84,7 +84,7 @@ SENSOR_TYPES = (
|
||||
# Name of selected meat in user language or user given custom name
|
||||
MeaterSensorEntityDescription(
|
||||
key="cook_name",
|
||||
name="Cooking",
|
||||
translation_key="cook_name",
|
||||
available=lambda probe: probe is not None and probe.cook is not None,
|
||||
value=lambda probe: probe.cook.name if probe.cook else None,
|
||||
),
|
||||
@ -92,15 +92,15 @@ SENSOR_TYPES = (
|
||||
# Slightly Underdone, Finished, Slightly Overdone, OVERCOOK!. Not translated.
|
||||
MeaterSensorEntityDescription(
|
||||
key="cook_state",
|
||||
name="Cook state",
|
||||
translation_key="cook_state",
|
||||
available=lambda probe: probe is not None and probe.cook is not None,
|
||||
value=lambda probe: probe.cook.state if probe.cook else None,
|
||||
),
|
||||
# Target temperature
|
||||
MeaterSensorEntityDescription(
|
||||
key="cook_target_temp",
|
||||
translation_key="cook_target_temp",
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
name="Target",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
available=lambda probe: probe is not None and probe.cook is not None,
|
||||
@ -111,8 +111,8 @@ SENSOR_TYPES = (
|
||||
# Peak temperature
|
||||
MeaterSensorEntityDescription(
|
||||
key="cook_peak_temp",
|
||||
translation_key="cook_peak_temp",
|
||||
device_class=SensorDeviceClass.TEMPERATURE,
|
||||
name="Peak",
|
||||
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
available=lambda probe: probe is not None and probe.cook is not None,
|
||||
@ -124,8 +124,8 @@ SENSOR_TYPES = (
|
||||
# Exposed as a TIMESTAMP sensor where the timestamp is current time + remaining time.
|
||||
MeaterSensorEntityDescription(
|
||||
key="cook_time_remaining",
|
||||
translation_key="cook_time_remaining",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
name="Remaining time",
|
||||
available=lambda probe: probe is not None and probe.cook is not None,
|
||||
value=_remaining_time_to_timestamp,
|
||||
),
|
||||
@ -133,8 +133,8 @@ SENSOR_TYPES = (
|
||||
# where the timestamp is current time - elapsed time.
|
||||
MeaterSensorEntityDescription(
|
||||
key="cook_time_elapsed",
|
||||
translation_key="cook_time_elapsed",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
name="Elapsed time",
|
||||
available=lambda probe: probe is not None and probe.cook is not None,
|
||||
value=_elapsed_time_to_timestamp,
|
||||
),
|
||||
@ -192,7 +192,6 @@ class MeaterProbeTemperature(
|
||||
) -> None:
|
||||
"""Initialise the sensor."""
|
||||
super().__init__(coordinator)
|
||||
self._attr_name = f"Meater Probe {description.name}"
|
||||
self._attr_device_info = DeviceInfo(
|
||||
identifiers={
|
||||
# Serial numbers are unique identifiers within a specific domain
|
||||
|
@ -26,5 +26,33 @@
|
||||
"unknown_auth_error": "[%key:common::config_flow::error::unknown%]",
|
||||
"service_unavailable_error": "The API is currently unavailable, please try again later."
|
||||
}
|
||||
},
|
||||
"entity": {
|
||||
"sensor": {
|
||||
"ambient": {
|
||||
"name": "Ambient temperature"
|
||||
},
|
||||
"internal": {
|
||||
"name": "Internal temperature"
|
||||
},
|
||||
"cook_name": {
|
||||
"name": "Cooking"
|
||||
},
|
||||
"cook_state": {
|
||||
"name": "Cook state"
|
||||
},
|
||||
"cook_target_temp": {
|
||||
"name": "Target temperature"
|
||||
},
|
||||
"cook_peak_temp": {
|
||||
"name": "Peak temperature"
|
||||
},
|
||||
"cook_time_remaining": {
|
||||
"name": "Time remaining"
|
||||
},
|
||||
"cook_time_elapsed": {
|
||||
"name": "Time elapsed"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user