diff --git a/custom_components/bwt_perla/sensor.py b/custom_components/bwt_perla/sensor.py index d26e070..219dc3f 100644 --- a/custom_components/bwt_perla/sensor.py +++ b/custom_components/bwt_perla/sensor.py @@ -119,30 +119,35 @@ async def async_setup_entry( coordinator, "day_output", UnitOfVolume.LITERS, + SensorStateClass.TOTAL_INCREASING, lambda data: data.treated_day, ), CalculatedSensor( coordinator, "month_output", UnitOfVolume.LITERS, + SensorStateClass.TOTAL_INCREASING, lambda data: data.treated_month, ), CalculatedSensor( coordinator, "year_output", UnitOfVolume.LITERS, + SensorStateClass.TOTAL_INCREASING, lambda data: data.treated_year, ), CalculatedSensor( coordinator, "capacity_1", UnitOfVolume.MILLILITERS, + SensorStateClass.MEASUREMENT, lambda data: data.capacity_1, ), CalculatedSensor( coordinator, "capacity_2", UnitOfVolume.MILLILITERS, + SensorStateClass.MEASUREMENT, lambda data: data.capacity_2, ), ] @@ -314,16 +319,23 @@ def _handle_coordinator_update(self) -> None: class CalculatedSensor(CoordinatorEntity[BwtCoordinator], SensorEntity): """Sensor calculating blended water from treated water.""" - _attr_state_class = SensorStateClass.TOTAL_INCREASING suggested_display_precision = 0 suggested_unit_of_measurement = UnitOfVolume.LITERS - def __init__(self, coordinator, key: str, unit: UnitOfVolume, extract) -> None: + def __init__( + self, + coordinator, + key: str, + unit: UnitOfVolume, + stateClass: SensorStateClass, + extract, + ) -> None: """Initialize the sensor with the common coordinator.""" super().__init__(coordinator) self._attr_translation_key = key self._attr_unique_id = self._attr_translation_key self._attr_native_unit_of_measurement = unit + self._attr_state_class = stateClass self._extract = extract @callback diff --git a/custom_components/bwt_perla/strings.json b/custom_components/bwt_perla/strings.json index 579be82..98b6731 100644 --- a/custom_components/bwt_perla/strings.json +++ b/custom_components/bwt_perla/strings.json @@ -66,6 +66,21 @@ }, "last_regeneration_2": { "name": "Last regeneration column 2" + }, + "capacity_1": { + "name": "Remaining capacity of column 1" + }, + "capacity_2": { + "name": "Remaining capacity of column 1" + }, + "day_output": { + "name": "Output of current day" + }, + "month_output": { + "name": "Output of current month" + }, + "year_output": { + "name": "Output of current year" } }, "binary_sensor": { diff --git a/custom_components/bwt_perla/translations/de.json b/custom_components/bwt_perla/translations/de.json index b041907..e2ac8b9 100644 --- a/custom_components/bwt_perla/translations/de.json +++ b/custom_components/bwt_perla/translations/de.json @@ -18,16 +18,51 @@ } }, "entity": { + "binary_sensor": { + "holiday_mode": { + "name": "Urlaubsmodus" + } + }, "sensor": { + "capacity_1": { + "name": "Verbleibende Kapazität Säule 1" + }, + "capacity_2": { + "name": "Verbleibende Kapazität Säule 2" + }, + "counter_regeneration_1": { + "name": "Regenerationszähler Säule 1" + }, + "counter_regeneration_2": { + "name": "Regenerationszähler Säule 2" + }, "customer_service": { "name": "Letzter Kunden Service " }, + "day_output": { + "name": "Wasserverbrauch heute" + }, + "errors": { + "name": "Aktive Fehlermeldungen" + }, "hardness_in": { "name": "Wasserhärte vor Gerät" }, "hardness_out": { "name": "Wasserhärte nach Gerät" }, + "holiday_mode_start": { + "name": "Zukünftiger Start des Urlaubsmodus" + }, + "last_regeneration_1": { + "name": "Letzte Regeneration Säule 1" + }, + "last_regeneration_2": { + "name": "Letzte Regeneration Säule 2" + }, + "month_output": { + "name": "Wasserverbrauch aktueller Monat" + }, "regenerativ_days": { "name": "Tage Regenerationsmittel übrig" }, @@ -45,6 +80,12 @@ }, "total_output": { "name": "Gesamter Wasserverbrauch" + }, + "warnings": { + "name": "Aktive Warnungen" + }, + "year_output": { + "name": "Wasserverbrauch aktuelles Jahr" } } } diff --git a/custom_components/bwt_perla/translations/en.json b/custom_components/bwt_perla/translations/en.json index f465199..7bc0eb9 100644 --- a/custom_components/bwt_perla/translations/en.json +++ b/custom_components/bwt_perla/translations/en.json @@ -18,24 +18,59 @@ } }, "entity": { + "binary_sensor": { + "holiday_mode": { + "name": "" + } + }, "sensor": { + "capacity_1": { + "name": "Remaining capacity of column 1" + }, + "capacity_2": { + "name": "Remaining capacity of column 1" + }, + "counter_regeneration_1": { + "name": "Regeneration counter column 1" + }, + "counter_regeneration_2": { + "name": "Regeneration counter column 2" + }, "customer_service": { "name": "Last service by customer" }, + "day_output": { + "name": "Output of current day" + }, + "errors": { + "name": "Active errors" + }, "hardness_in": { "name": "Incoming water hardness" }, "hardness_out": { "name": "Outgoing water hardness" }, + "holiday_mode_start": { + "name": "Future start of holiday mode if available" + }, + "last_regeneration_1": { + "name": "Last regeneration column 1" + }, + "last_regeneration_2": { + "name": "Last regeneration column 2" + }, + "month_output": { + "name": "Output of current month" + }, "regenerativ_days": { "name": "Days left of regeneration salt" }, "regenerativ_level": { - "name": "Percentage of regeneration salt" + "name": "Precentage of regeneration salt" }, "regenerativ_mass": { - "name": "Remaining regeneration salt" + "name": "Total regeneration salt ever used" }, "state": { "name": "State of the machine" @@ -45,6 +80,12 @@ }, "total_output": { "name": "Total water consumption" + }, + "warnings": { + "name": "Active warnings" + }, + "year_output": { + "name": "Output of current year" } } }