Fix errors, bump pyhon

This commit is contained in:
Andre Basche 2023-05-07 00:52:54 +02:00
parent 8aa8563b9b
commit 130327ad14
9 changed files with 35 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)
- [Hob](https://github.com/Andre0512/hon#hob)
- [Dish Washer](https://github.com/Andre0512/hon#dish-washer)
- [Air conditioner](https://github.com/Andre0512/hon#air-conditioner) [BETA]
## 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)
@ -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` |
| Powder Detergent Dose | `cup` | `sensor` | `startProgram.powderDetergentDose` |
| Program | | `select` | `startProgram.program` |
| Remaining Time | `timer` | `sensor` | `startProgram.remainingTime` |
| Rinse Iterations | `rotate-right` | `number` | `startProgram.rinseIterations` |
| Soak Prewash Selection | `tshirt-crew` | `switch` | `startProgram.haier_SoakPrewashSelection` |
| Spin speed | `numeric` | `select` | `startProgram.spinSpeed` |

View File

@ -23,8 +23,8 @@ from homeassistant.core import callback
from pyhon import Hon
from pyhon.appliance import HonAppliance
from custom_components.hon.const import HON_HVAC_MODE, HON_FAN, HON_HVAC_PROGRAM, DOMAIN
from custom_components.hon.hon import HonEntity, HonCoordinator
from .const import HON_HVAC_MODE, HON_FAN, HON_HVAC_PROGRAM, DOMAIN
from .hon import HonEntity, HonCoordinator
_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):
for description in descriptions:
if not device.settings.get(description.key):
if description.key not in device.available_settings:
continue
appliances.extend(
[HonClimateEntity(hass, coordinator, entry, device, description)]

View File

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

View File

@ -6,6 +6,6 @@
"documentation": "https://github.com/Andre0512/hon/",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/Andre0512/hon/issues",
"requirements": ["pyhOn==0.9.1"],
"version": "0.7.0-beta.7"
"requirements": ["pyhOn==0.10.2"],
"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):
for description in descriptions:
if not device.settings.get(description.key):
if description.key not in device.available_settings:
continue
appliances.extend(
[HonNumberEntity(hass, coordinator, entry, device, description)]

View File

@ -1,6 +1,7 @@
from __future__ import annotations
import logging
import time
from pyhon import Hon
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):
for description in descriptions:
if not device.settings.get(description.key):
if description.key not in device.available_settings:
continue
appliances.extend(
[HonSelectEntity(hass, coordinator, entry, device, description)]

View File

@ -131,6 +131,15 @@ SENSORS: dict[str, tuple[SensorEntityDescription, ...]] = {
entity_category=EntityCategory.CONFIG,
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": (
SensorEntityDescription(

View File

@ -271,7 +271,7 @@ async def async_setup_entry(hass, entry: ConfigEntry, async_add_entities) -> Non
for description in descriptions:
if (
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(
[HonSwitchEntity(hass, coordinator, entry, device, description)]

3
requirements_dev.txt Normal file
View File

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