Handle missing widget in lamarzocco (#147047)

This commit is contained in:
Josef Zweck 2025-06-17 21:25:27 +02:00 committed by GitHub
parent 81257f9d57
commit 5e31b5ac4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View File

@ -58,6 +58,10 @@ ENTITIES: tuple[LaMarzoccoNumberEntityDescription, ...] = (
CoffeeBoiler, machine.dashboard.config[WidgetType.CM_COFFEE_BOILER] CoffeeBoiler, machine.dashboard.config[WidgetType.CM_COFFEE_BOILER]
).target_temperature ).target_temperature
), ),
available_fn=(
lambda coordinator: WidgetType.CM_COFFEE_BOILER
in coordinator.device.dashboard.config
),
), ),
LaMarzoccoNumberEntityDescription( LaMarzoccoNumberEntityDescription(
key="smart_standby_time", key="smart_standby_time",
@ -221,7 +225,7 @@ class LaMarzoccoNumberEntity(LaMarzoccoEntity, NumberEntity):
entity_description: LaMarzoccoNumberEntityDescription entity_description: LaMarzoccoNumberEntityDescription
@property @property
def native_value(self) -> float: def native_value(self) -> float | int:
"""Return the current value.""" """Return the current value."""
return self.entity_description.native_value_fn(self.coordinator.device) return self.entity_description.native_value_fn(self.coordinator.device)

View File

@ -57,6 +57,10 @@ ENTITIES: tuple[LaMarzoccoSensorEntityDescription, ...] = (
).ready_start_time ).ready_start_time
), ),
entity_category=EntityCategory.DIAGNOSTIC, entity_category=EntityCategory.DIAGNOSTIC,
available_fn=(
lambda coordinator: WidgetType.CM_COFFEE_BOILER
in coordinator.device.dashboard.config
),
), ),
LaMarzoccoSensorEntityDescription( LaMarzoccoSensorEntityDescription(
key="steam_boiler_ready_time", key="steam_boiler_ready_time",