Wallbox Integration Change Switch Availability (#98111)

* change switch availability

* remove new test

* Update homeassistant/components/wallbox/switch.py

Also check super availability.

Co-authored-by: G Johansson <goran.johansson@shiftit.se>

* black formatting

---------

Co-authored-by: G Johansson <goran.johansson@shiftit.se>
This commit is contained in:
Hessel 2023-08-11 16:39:29 +02:00 committed by GitHub
parent 7f616b0d44
commit 8bef39a2fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,11 +54,16 @@ class WallboxSwitch(WallboxEntity, SwitchEntity):
@property
def available(self) -> bool:
"""Return the availability of the switch."""
return self.coordinator.data[CHARGER_STATUS_DESCRIPTION_KEY] in {
ChargerStatus.CHARGING,
ChargerStatus.DISCHARGING,
ChargerStatus.PAUSED,
ChargerStatus.SCHEDULED,
return super().available and self.coordinator.data[
CHARGER_STATUS_DESCRIPTION_KEY
] not in {
ChargerStatus.UNKNOWN,
ChargerStatus.UPDATING,
ChargerStatus.ERROR,
ChargerStatus.LOCKED,
ChargerStatus.LOCKED_CAR_CONNECTED,
ChargerStatus.DISCONNECTED,
ChargerStatus.READY,
}
@property