Support disconnected Powerwall configuration (#67325)

Co-authored-by: J. Nick Koston <nick@koston.org>
pull/67487/head
Jeff 2022-02-28 11:37:11 -08:00 committed by Paulus Schoutsen
parent d766b17323
commit 26203e9924
1 changed files with 9 additions and 0 deletions

View File

@ -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."""