From 4e121fcbe8bad583052a26b2a33e3bb88122aa40 Mon Sep 17 00:00:00 2001 From: Josef Zweck <24647999+zweckj@users.noreply.github.com> Date: Wed, 12 Jun 2024 23:35:51 +0200 Subject: [PATCH] Remove steam temp sensor for Linea Mini (#119423) --- homeassistant/components/lamarzocco/sensor.py | 4 +++- tests/components/lamarzocco/test_sensor.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/lamarzocco/sensor.py b/homeassistant/components/lamarzocco/sensor.py index c43ea0f99bc..225f0a43c5c 100644 --- a/homeassistant/components/lamarzocco/sensor.py +++ b/homeassistant/components/lamarzocco/sensor.py @@ -3,7 +3,7 @@ from collections.abc import Callable from dataclasses import dataclass -from lmcloud.const import BoilerType, PhysicalKey +from lmcloud.const import BoilerType, MachineModel, PhysicalKey from lmcloud.lm_machine import LaMarzoccoMachine from homeassistant.components.sensor import ( @@ -80,6 +80,8 @@ ENTITIES: tuple[LaMarzoccoSensorEntityDescription, ...] = ( value_fn=lambda device: device.config.boilers[ BoilerType.STEAM ].current_temperature, + supported_fn=lambda coordinator: coordinator.device.model + != MachineModel.LINEA_MINI, ), ) diff --git a/tests/components/lamarzocco/test_sensor.py b/tests/components/lamarzocco/test_sensor.py index b5f551309b6..1ce56724fa3 100644 --- a/tests/components/lamarzocco/test_sensor.py +++ b/tests/components/lamarzocco/test_sensor.py @@ -2,6 +2,7 @@ from unittest.mock import MagicMock +from lmcloud.const import MachineModel import pytest from syrupy import SnapshotAssertion @@ -71,3 +72,17 @@ async def test_shot_timer_unavailable( state = hass.states.get(f"sensor.{mock_lamarzocco.serial_number}_shot_timer") assert state assert state.state == STATE_UNAVAILABLE + + +@pytest.mark.parametrize("device_fixture", [MachineModel.LINEA_MINI]) +async def test_no_steam_linea_mini( + hass: HomeAssistant, + mock_lamarzocco: MagicMock, + mock_config_entry: MockConfigEntry, +) -> None: + """Ensure Linea Mini has no steam temp.""" + await async_init_integration(hass, mock_config_entry) + + serial_number = mock_lamarzocco.serial_number + state = hass.states.get(f"sensor.{serial_number}_current_temp_steam") + assert state is None