Fix total coffees sensor for lamarzocco (#135283)

pull/136719/head
Josef Zweck 2025-01-28 14:09:22 +01:00 committed by GitHub
parent c4f8de8fd9
commit 2c3cd6e119
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -3,7 +3,7 @@
from collections.abc import Callable from collections.abc import Callable
from dataclasses import dataclass from dataclasses import dataclass
from pylamarzocco.const import BoilerType, MachineModel, PhysicalKey from pylamarzocco.const import BoilerType, MachineModel
from pylamarzocco.devices.machine import LaMarzoccoMachine from pylamarzocco.devices.machine import LaMarzoccoMachine
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
@ -81,7 +81,7 @@ STATISTIC_ENTITIES: tuple[LaMarzoccoSensorEntityDescription, ...] = (
translation_key="drink_stats_coffee", translation_key="drink_stats_coffee",
native_unit_of_measurement="drinks", native_unit_of_measurement="drinks",
state_class=SensorStateClass.TOTAL_INCREASING, state_class=SensorStateClass.TOTAL_INCREASING,
value_fn=lambda device: device.statistics.drink_stats.get(PhysicalKey.A, 0), value_fn=lambda device: device.statistics.total_coffee,
available_fn=lambda device: len(device.statistics.drink_stats) > 0, available_fn=lambda device: len(device.statistics.drink_stats) > 0,
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,
), ),

View File

@ -256,7 +256,7 @@
'last_changed': <ANY>, 'last_changed': <ANY>,
'last_reported': <ANY>, 'last_reported': <ANY>,
'last_updated': <ANY>, 'last_updated': <ANY>,
'state': '1047', 'state': '2387',
}) })
# --- # ---
# name: test_sensors[sensor.gs012345_total_flushes_made-entry] # name: test_sensors[sensor.gs012345_total_flushes_made-entry]