From 508ed257d46eb0b7e55f15fcb8114f43f8faa2c4 Mon Sep 17 00:00:00 2001 From: Jeff <34590663+jumbledbytes@users.noreply.github.com> Date: Mon, 28 Feb 2022 11:37:11 -0800 Subject: [PATCH] Support disconnected Powerwall configuration (#67325) Co-authored-by: J. Nick Koston --- homeassistant/components/powerwall/binary_sensor.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/homeassistant/components/powerwall/binary_sensor.py b/homeassistant/components/powerwall/binary_sensor.py index 868d9e3076d..fed47823c7f 100644 --- a/homeassistant/components/powerwall/binary_sensor.py +++ b/homeassistant/components/powerwall/binary_sensor.py @@ -110,6 +110,15 @@ class PowerWallChargingStatusSensor(PowerWallEntity, BinarySensorEntity): _attr_name = "Powerwall Charging" _attr_device_class = BinarySensorDeviceClass.BATTERY_CHARGING + @property + def available(self) -> bool: + """Powerwall is available.""" + # Return False if no battery is installed + return ( + super().available + and self.data.meters.get_meter(MeterType.BATTERY) is not None + ) + @property def unique_id(self) -> str: """Device Uniqueid."""