Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions homeassistant/components/meater/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def _remaining_time_to_timestamp(probe: MeaterProbe) -> datetime | None:
# 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,
Expand All @@ -74,8 +74,8 @@ def _remaining_time_to_timestamp(probe: MeaterProbe) -> datetime | None:
# 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,
Expand All @@ -84,23 +84,23 @@ def _remaining_time_to_timestamp(probe: MeaterProbe) -> datetime | None:
# 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,
),
# One of Not Started, Configured, Started, Ready For Resting, Resting,
# 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,
Expand All @@ -111,8 +111,8 @@ def _remaining_time_to_timestamp(probe: MeaterProbe) -> datetime | None:
# 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,
Expand All @@ -124,17 +124,17 @@ def _remaining_time_to_timestamp(probe: MeaterProbe) -> datetime | None:
# 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,
),
# Time since the start of cook in seconds. Default: 0. Exposed as a TIMESTAMP sensor
# 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,
),
Expand Down Expand Up @@ -192,7 +192,6 @@ def __init__(
) -> 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
Expand Down
28 changes: 28 additions & 0 deletions homeassistant/components/meater/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
}