From e1a2af70e91a034fc1a8c589b70799cf629715b4 Mon Sep 17 00:00:00 2001 From: Andre Basche Date: Sat, 8 Apr 2023 06:15:33 +0200 Subject: [PATCH] Bump to v0.4.0 --- README.md | 23 +++++++++++++---------- custom_components/hon/button.py | 20 +++----------------- custom_components/hon/manifest.json | 2 +- custom_components/hon/number.py | 2 ++ custom_components/hon/select.py | 3 +-- custom_components/hon/switch.py | 7 +++---- 6 files changed, 23 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index de2243b..72f0051 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,27 @@ # Haier hOn [![hacs_badge](https://img.shields.io/badge/HACS-Default-41BDF5.svg)](https://github.com/hacs/integration) - +[![GitHub manifest version (path)](https://img.shields.io/github/manifest-json/v/andre0512/hon?color=g&filename=custom_components%2Fhon%2Fmanifest.json)](https://github.com/Andre0512/hon/releases/latest) +[![Home Assistant installs](https://img.shields.io/badge/dynamic/json?color=41BDF5&label=usage&suffix=%20installs&cacheSeconds=15600&url=https://analytics.home-assistant.io/custom_integrations.json&query=$.hon.total)](https://analytics.home-assistant.io/) Home Assistant integration for Haier hOn: support for Haier/Candy/Hoover home appliances like washing machines. ## Supported Appliances -- Washing Machine - Tumble Dryer - +- Washer Dryer +- Washing Machine +- Oven ## Installation -[![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=Andre0512&repository=hon&category=integration) +**Method 1:** [![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=Andre0512&repository=hon&category=integration) -**Method 1:** [HACS](https://hacs.xyz/) > Integrations > Add Integration > **Haier hOn** > Install +**Method 2:** [HACS](https://hacs.xyz/) > Integrations > Add Integration > **Haier hOn** > Install -**Method 2.** Manually copy `hon` folder from [latest release](https://github.com/Andre0512/hon/releases/latest) to `/config/custom_components` folder. +**Method 3:** Manually copy `hon` folder from [latest release](https://github.com/Andre0512/hon/releases/latest) to `config/custom_components` folder. ## Configuration -[![Open your Home Assistant instance and start setting up a new integration.](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=hon) +**Method 1**: [![Open your Home Assistant instance and start setting up a new integration.](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=hon) -Settings > Devices & Services > Add Integration > **Haier hOn** - -If the integration is not in the list, you need to clear the browser cache. +**Method 2**: Settings > Devices & Services > Add Integration > **Haier hOn** +_If the integration is not in the list, you need to clear the browser cache._ ## Contribute Any kind of contribution is welcome! @@ -70,6 +71,8 @@ Any kind of contribution is welcome! ## Tested Devices - Haier WD90-B14TEAM5 - Haier HD80-A3959 +- Haier HWO60SM2F3XH +- Hoover H-WASH 500 ## About this Repo The existing integrations missed some features from the app I liked to have in HomeAssistant. diff --git a/custom_components/hon/button.py b/custom_components/hon/button.py index 940791d..4e24709 100644 --- a/custom_components/hon/button.py +++ b/custom_components/hon/button.py @@ -1,27 +1,13 @@ -from pyhon import HonConnection -from pyhon.device import HonDevice - from homeassistant.components.button import ButtonEntityDescription, ButtonEntity from homeassistant.config_entries import ConfigEntry +from pyhon import HonConnection +from pyhon.device import HonDevice from .const import DOMAIN from .hon import HonCoordinator, HonEntity BUTTONS: dict[str, tuple[ButtonEntityDescription, ...]] = { - "WM": ( - # ButtonEntityDescription( - # key="pauseProgram", - # name="Pause Program", - # icon="mdi:pause", - # ), - # ButtonEntityDescription( - # key="resumeProgram", - # name="Resume Program", - # icon="mdi:play-pause", - # ), - ), - - "OV":( + "OV": ( ButtonEntityDescription( key="startProgram", name="Start Program", diff --git a/custom_components/hon/manifest.json b/custom_components/hon/manifest.json index 07e6f30..ea42851 100644 --- a/custom_components/hon/manifest.json +++ b/custom_components/hon/manifest.json @@ -7,6 +7,6 @@ "iot_class": "cloud_polling", "issue_tracker": "https://github.com/Andre0512/hon/issues", "requirements": ["pyhOn==0.4.1"], - "version": "0.3.0" + "version": "0.4.0" } diff --git a/custom_components/hon/number.py b/custom_components/hon/number.py index 6335961..9ec2a0a 100644 --- a/custom_components/hon/number.py +++ b/custom_components/hon/number.py @@ -124,6 +124,8 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non if descriptions := NUMBERS.get(device.appliance_type): for description in descriptions: + if not device.settings.get(description.key): + continue appliances.extend([ HonNumberEntity(hass, coordinator, entry, device, description)] ) diff --git a/custom_components/hon/select.py b/custom_components/hon/select.py index c492661..70c3468 100644 --- a/custom_components/hon/select.py +++ b/custom_components/hon/select.py @@ -92,8 +92,7 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non if descriptions := SELECTS.get(device.appliance_type): for description in descriptions: - if not device.get(description.key): - _LOGGER.warning("[%s] Can't setup %s", device.appliance_type, description.key) + if not device.settings.get(description.key): continue appliances.extend([ HonSelectEntity(hass, coordinator, entry, device, description)] diff --git a/custom_components/hon/switch.py b/custom_components/hon/switch.py index 7dbf3a4..a4d3bf7 100644 --- a/custom_components/hon/switch.py +++ b/custom_components/hon/switch.py @@ -14,6 +14,7 @@ from .hon import HonCoordinator, HonEntity _LOGGER = logging.getLogger(__name__) + @dataclass class HonSwitchEntityDescriptionMixin: turn_on_key: str = "" @@ -22,8 +23,8 @@ class HonSwitchEntityDescriptionMixin: @dataclass class HonSwitchEntityDescription(HonSwitchEntityDescriptionMixin, - SwitchEntityDescription -): + SwitchEntityDescription + ): pass @@ -153,5 +154,3 @@ class HonSwitchEntity(HonEntity, SwitchEntity): self.async_write_ha_state() else: await self._device.commands[self.entity_description.turn_off_key].send() - -