Fix errors, bump pyhon

This commit is contained in:
Andre Basche 2023-05-07 00:52:54 +02:00
parent 8aa8563b9b
commit 2802bcad25
10 changed files with 36 additions and 16 deletions

View File

@ -12,6 +12,7 @@ Home Assistant integration for Haier hOn: support for Haier/Candy/Hoover home ap
- [Oven](https://github.com/Andre0512/hon#oven) - [Oven](https://github.com/Andre0512/hon#oven)
- [Hob](https://github.com/Andre0512/hon#hob) - [Hob](https://github.com/Andre0512/hon#hob)
- [Dish Washer](https://github.com/Andre0512/hon#dish-washer) - [Dish Washer](https://github.com/Andre0512/hon#dish-washer)
- [Air conditioner](https://github.com/Andre0512/hon#air-conditioner) [BETA]
## Installation ## Installation
**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:** [![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)
@ -323,6 +324,7 @@ I moved the api related stuff into the package [pyhOn](https://github.com/Andre0
| Main Wash Time | `clock-start` | `number` | `startProgram.mainWashTime` | | Main Wash Time | `clock-start` | `number` | `startProgram.mainWashTime` |
| Powder Detergent Dose | `cup` | `sensor` | `startProgram.powderDetergentDose` | | Powder Detergent Dose | `cup` | `sensor` | `startProgram.powderDetergentDose` |
| Program | | `select` | `startProgram.program` | | Program | | `select` | `startProgram.program` |
| Remaining Time | `timer` | `sensor` | `startProgram.remainingTime` |
| Rinse Iterations | `rotate-right` | `number` | `startProgram.rinseIterations` | | Rinse Iterations | `rotate-right` | `number` | `startProgram.rinseIterations` |
| Soak Prewash Selection | `tshirt-crew` | `switch` | `startProgram.haier_SoakPrewashSelection` | | Soak Prewash Selection | `tshirt-crew` | `switch` | `startProgram.haier_SoakPrewashSelection` |
| Spin speed | `numeric` | `select` | `startProgram.spinSpeed` | | Spin speed | `numeric` | `select` | `startProgram.spinSpeed` |

View File

@ -23,8 +23,8 @@ from homeassistant.core import callback
from pyhon import Hon from pyhon import Hon
from pyhon.appliance import HonAppliance from pyhon.appliance import HonAppliance
from custom_components.hon.const import HON_HVAC_MODE, HON_FAN, HON_HVAC_PROGRAM, DOMAIN from .const import HON_HVAC_MODE, HON_FAN, HON_HVAC_PROGRAM, DOMAIN
from custom_components.hon.hon import HonEntity, HonCoordinator from .hon import HonEntity, HonCoordinator
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -47,7 +47,7 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
if descriptions := CLIMATES.get(device.appliance_type): if descriptions := CLIMATES.get(device.appliance_type):
for description in descriptions: for description in descriptions:
if not device.settings.get(description.key): if description.key not in device.available_settings:
continue continue
appliances.extend( appliances.extend(
[HonClimateEntity(hass, coordinator, entry, device, description)] [HonClimateEntity(hass, coordinator, entry, device, description)]

View File

@ -1,6 +1,10 @@
from homeassistant.components.climate import HVACMode from homeassistant.components.climate import (
HVACMode,
from custom_components.hon import climate FAN_LOW,
FAN_MEDIUM,
FAN_HIGH,
FAN_AUTO,
)
DOMAIN = "hon" DOMAIN = "hon"
@ -33,9 +37,9 @@ HON_HVAC_PROGRAM = {
} }
HON_FAN = { HON_FAN = {
"1": climate.FAN_HIGH, "1": FAN_HIGH,
"2": climate.FAN_MEDIUM, "2": FAN_MEDIUM,
"3": climate.FAN_LOW, "3": FAN_LOW,
"4": climate.FAN_AUTO, "4": FAN_AUTO,
"5": climate.FAN_AUTO, "5": FAN_AUTO,
} }

View File

@ -6,6 +6,6 @@
"documentation": "https://github.com/Andre0512/hon/", "documentation": "https://github.com/Andre0512/hon/",
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"issue_tracker": "https://github.com/Andre0512/hon/issues", "issue_tracker": "https://github.com/Andre0512/hon/issues",
"requirements": ["pyhOn==0.9.1"], "requirements": ["pyhOn==0.10.3"],
"version": "0.7.0-beta.7" "version": "0.7.0-beta.8"
} }

View File

@ -162,7 +162,7 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
if descriptions := NUMBERS.get(device.appliance_type): if descriptions := NUMBERS.get(device.appliance_type):
for description in descriptions: for description in descriptions:
if not device.settings.get(description.key): if description.key not in device.available_settings:
continue continue
appliances.extend( appliances.extend(
[HonNumberEntity(hass, coordinator, entry, device, description)] [HonNumberEntity(hass, coordinator, entry, device, description)]

View File

@ -1,6 +1,7 @@
from __future__ import annotations from __future__ import annotations
import logging import logging
import time
from pyhon import Hon from pyhon import Hon
from pyhon.appliance import HonAppliance from pyhon.appliance import HonAppliance
@ -128,7 +129,7 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
if descriptions := SELECTS.get(device.appliance_type): if descriptions := SELECTS.get(device.appliance_type):
for description in descriptions: for description in descriptions:
if not device.settings.get(description.key): if description.key not in device.available_settings:
continue continue
appliances.extend( appliances.extend(
[HonSelectEntity(hass, coordinator, entry, device, description)] [HonSelectEntity(hass, coordinator, entry, device, description)]

View File

@ -131,6 +131,15 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG, entity_category=EntityCategory.CONFIG,
translation_key="det_dust", translation_key="det_dust",
), ),
SensorEntityDescription(
key="startProgram.remainingTime",
name="Remaining Time",
icon="mdi:timer",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTime.MINUTES,
entity_category=EntityCategory.CONFIG,
translation_key="remaining_time",
),
), ),
"TD": ( "TD": (
SensorEntityDescription( SensorEntityDescription(

View File

@ -271,7 +271,7 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
for description in descriptions: for description in descriptions:
if ( if (
device.get(description.key) is not None device.get(description.key) is not None
or device.commands.get(description.key) is not None or description.key in device.available_settings
): ):
appliances.extend( appliances.extend(
[HonSwitchEntity(hass, coordinator, entry, device, description)] [HonSwitchEntity(hass, coordinator, entry, device, description)]

View File

@ -11,6 +11,7 @@ Support for home appliances of Haier's mobile app hOn.
- [Oven](https://github.com/Andre0512/hon#oven) - [Oven](https://github.com/Andre0512/hon#oven)
- [Hob](https://github.com/Andre0512/hon#hob) - [Hob](https://github.com/Andre0512/hon#hob)
- [Dish Washer](https://github.com/Andre0512/hon#dish-washer) - [Dish Washer](https://github.com/Andre0512/hon#dish-washer)
- [Air conditioner](https://github.com/Andre0512/hon#air-conditioner) [BETA]
## Tested Appliances ## Tested Appliances
- Haier WD90-B14TEAM5 - Haier WD90-B14TEAM5

3
requirements_dev.txt Normal file
View File

@ -0,0 +1,3 @@
pyhOn
black
homeassistant