From b6cc0cf6db78d6e60ff7090784008bf0faf15a26 Mon Sep 17 00:00:00 2001 From: Maciej Bieniek <478555+bieniu@users.noreply.github.com> Date: Sun, 17 Mar 2024 20:17:50 +0100 Subject: [PATCH] Add removal condition to Shelly battery sensor --- homeassistant/components/shelly/sensor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/homeassistant/components/shelly/sensor.py b/homeassistant/components/shelly/sensor.py index ec5f31dae8a2d..ad25c83a19b09 100644 --- a/homeassistant/components/shelly/sensor.py +++ b/homeassistant/components/shelly/sensor.py @@ -942,6 +942,7 @@ class RestSensorDescription(RestEntityDescription, SensorEntityDescription): device_class=SensorDeviceClass.BATTERY, state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, + removal_condition=lambda _config, status, key: (status[key]["battery"] is None), ), "voltmeter": RpcSensorDescription( key="voltmeter",