diff --git a/homeassistant/components/youless/sensor.py b/homeassistant/components/youless/sensor.py index 81cd8b384d2..ed0fc703cc4 100644 --- a/homeassistant/components/youless/sensor.py +++ b/homeassistant/components/youless/sensor.py @@ -42,6 +42,7 @@ async def async_setup_entry( async_add_entities( [ + WaterSensor(coordinator, device), GasSensor(coordinator, device), EnergyMeterSensor( coordinator, device, "low", SensorStateClass.TOTAL_INCREASING @@ -110,6 +111,27 @@ class YoulessBaseSensor( return super().available and self.get_sensor is not None +class WaterSensor(YoulessBaseSensor): + """The Youless Water sensor.""" + + _attr_native_unit_of_measurement = UnitOfVolume.CUBIC_METERS + _attr_device_class = SensorDeviceClass.WATER + _attr_state_class = SensorStateClass.TOTAL_INCREASING + + def __init__( + self, coordinator: DataUpdateCoordinator[YoulessAPI], device: str + ) -> None: + """Instantiate a Water sensor.""" + super().__init__(coordinator, device, "water", "Water meter", "water") + self._attr_name = "Water usage" + self._attr_icon = "mdi:water" + + @property + def get_sensor(self) -> YoulessSensor | None: + """Get the sensor for providing the value.""" + return self.coordinator.data.water_meter + + class GasSensor(YoulessBaseSensor): """The Youless gas sensor."""