Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e592e56

Browse files
authored
Make ready time sensors unavailable instead in lamarzocco (home-assistant#147985)
1 parent 12b90f3 commit e592e56

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

‎homeassistant/components/lamarzocco/sensor.py‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ class LaMarzoccoSensorEntityDescription(
5656
CoffeeBoiler, config[WidgetType.CM_COFFEE_BOILER]
5757
).ready_start_time
5858
),
59+
available_fn=(
60+
lambda coordinator: cast(
61+
CoffeeBoiler,
62+
coordinator.device.dashboard.config[WidgetType.CM_COFFEE_BOILER],
63+
).ready_start_time
64+
is not None
65+
),
5966
entity_category=EntityCategory.DIAGNOSTIC,
6067
),
6168
LaMarzoccoSensorEntityDescription(
@@ -67,11 +74,18 @@ class LaMarzoccoSensorEntityDescription(
6774
SteamBoilerLevel, config[WidgetType.CM_STEAM_BOILER_LEVEL]
6875
).ready_start_time
6976
),
70-
entity_category=EntityCategory.DIAGNOSTIC,
7177
supported_fn=(
7278
lambda coordinator: coordinator.device.dashboard.model_name
7379
in (ModelName.LINEA_MICRA, ModelName.LINEA_MINI_R)
7480
),
81+
available_fn=(
82+
lambda coordinator: cast(
83+
SteamBoilerLevel,
84+
coordinator.device.dashboard.config[WidgetType.CM_STEAM_BOILER_LEVEL],
85+
).ready_start_time
86+
is not None
87+
),
88+
entity_category=EntityCategory.DIAGNOSTIC,
7589
),
7690
LaMarzoccoSensorEntityDescription(
7791
key="brewing_start_time",

‎tests/components/lamarzocco/snapshots/test_sensor.ambr‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
'last_changed': <ANY>,
9595
'last_reported': <ANY>,
9696
'last_updated': <ANY>,
97-
'state': 'unknown',
97+
'state': 'unavailable',
9898
})
9999
# ---
100100
# name: test_sensors[sensor.gs012345_last_cleaning_time-entry]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /