Home Connect add WasherDryer support (#90673)

This commit is contained in:
stickpin 2023-04-30 18:50:51 +02:00 committed by GitHub
parent cd52e05075
commit 9317ddb1c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 0 deletions

View file

@ -74,6 +74,8 @@ class ConfigEntryAuth(homeconnect.HomeConnectAPI):
device = Dryer(self.hass, app)
elif app.type == "Washer":
device = Washer(self.hass, app)
elif app.type == "WasherDryer":
device = WasherDryer(self.hass, app)
elif app.type == "Dishwasher":
device = Dishwasher(self.hass, app)
elif app.type == "FridgeFreezer":
@ -358,6 +360,30 @@ class Washer(
}
class WasherDryer(
DeviceWithDoor,
DeviceWithOpState,
DeviceWithPrograms,
DeviceWithRemoteControl,
DeviceWithRemoteStart,
):
"""WasherDryer class."""
def get_entity_info(self):
"""Get a dictionary with infos about the associated entities."""
door_entity = self.get_door_entity()
remote_control = self.get_remote_control()
remote_start = self.get_remote_start()
op_state_sensor = self.get_opstate_sensor()
program_sensors = self.get_program_sensors()
program_switches = self.get_program_switches()
return {
"binary_sensor": [door_entity, remote_control, remote_start],
"switch": program_switches,
"sensor": program_sensors + op_state_sensor,
}
class CoffeeMaker(DeviceWithOpState, DeviceWithPrograms, DeviceWithRemoteStart):
"""Coffee maker class."""

View file

@ -50,6 +50,10 @@ class HomeConnectProgramSwitch(HomeConnectEntity, SwitchEntity):
def __init__(self, device, program_name):
"""Initialize the entity."""
desc = " ".join(["Program", program_name.split(".")[-1]])
if device.appliance.type == "WasherDryer":
desc = " ".join(
["Program", program_name.split(".")[-3], program_name.split(".")[-1]]
)
super().__init__(device, desc)
self.program_name = program_name
self._state = None