Skip to content

Commit

Permalink
Fix errors, bump pyhon
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre0512 committed May 6, 2023
1 parent 8aa8563 commit 130327a
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 16 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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` |
Expand Down
6 changes: 3 additions & 3 deletions custom_components/hon/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
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__)

Expand All @@ -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)]
Expand Down
20 changes: 12 additions & 8 deletions custom_components/hon/const.py
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -33,9 +37,9 @@
}

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,
}
4 changes: 2 additions & 2 deletions custom_components/hon/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
2 changes: 1 addition & 1 deletion custom_components/hon/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
3 changes: 2 additions & 1 deletion custom_components/hon/select.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import logging
import time

from pyhon import Hon
from pyhon.appliance import HonAppliance
Expand Down Expand Up @@ -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)]
Expand Down
9 changes: 9 additions & 0 deletions custom_components/hon/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@
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(
Expand Down
2 changes: 1 addition & 1 deletion custom_components/hon/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
3 changes: 3 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pyhOn
black
homeassistant

0 comments on commit 130327a

Please sign in to comment.