diff --git a/homeassistant/components/notion/const.py b/homeassistant/components/notion/const.py index 5e89767d0e0..0961b7c10c5 100644 --- a/homeassistant/components/notion/const.py +++ b/homeassistant/components/notion/const.py @@ -9,6 +9,7 @@ SENSOR_DOOR = "door" SENSOR_GARAGE_DOOR = "garage_door" SENSOR_LEAK = "leak" SENSOR_MISSING = "missing" +SENSOR_MOLD = "mold" SENSOR_SAFE = "safe" SENSOR_SLIDING = "sliding" SENSOR_SMOKE_CO = "alarm" diff --git a/homeassistant/components/notion/sensor.py b/homeassistant/components/notion/sensor.py index e6ff3eaab69..6f011523a2a 100644 --- a/homeassistant/components/notion/sensor.py +++ b/homeassistant/components/notion/sensor.py @@ -15,7 +15,7 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallback from . import NotionEntity -from .const import DOMAIN, SENSOR_TEMPERATURE +from .const import DOMAIN, SENSOR_MOLD, SENSOR_TEMPERATURE from .model import NotionEntityDescriptionMixin @@ -25,6 +25,12 @@ class NotionSensorDescription(SensorEntityDescription, NotionEntityDescriptionMi SENSOR_DESCRIPTIONS = ( + NotionSensorDescription( + key=SENSOR_MOLD, + name="Mold risk", + icon="mdi:liquid-spot", + listener_kind=ListenerKind.MOLD, + ), NotionSensorDescription( key=SENSOR_TEMPERATURE, name="Temperature", @@ -76,11 +82,11 @@ class NotionSensor(NotionEntity, SensorEntity): @property def native_value(self) -> str | None: - """Return the value reported by the sensor. - - The Notion API only returns a localized string for temperature (e.g. "70°"); we - simply remove the degree symbol: - """ + """Return the value reported by the sensor.""" if not self.listener.status_localized: return None - return self.listener.status_localized.state[:-1] + if self.listener.listener_kind == ListenerKind.TEMPERATURE: + # The Notion API only returns a localized string for temperature (e.g. + # "70°"); we simply remove the degree symbol: + return self.listener.status_localized.state[:-1] + return self.listener.status_localized.state