Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #11 from thomasgermain/v1_2_3
Browse files Browse the repository at this point in the history
Release 1.2.3
  • Loading branch information
thomasgermain authored May 24, 2020
2 parents 85c6348 + c4fa5f6 commit 35ba756
Show file tree
Hide file tree
Showing 32 changed files with 120 additions and 117 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ First release using config flow
### [1.2.2](https://github.com/thomasgermain/vaillant-component/releases/tag/1.2.2)
- Better error handling
- Component does a reconnection every time an error occurs
### [1.2.3](https://github.com/thomasgermain/vaillant-component/releases/tag/1.2.3)
- Adapt to HA 0.110 deprecation/warning
- Add some None-check in case of error when component is starting
- Fix issue with `set_holiday_mode` (ValueError: unconverted data remains: T00:00:00.000Z)

## Provided entities
- 1 water_heater entity, if any water heater: `water_heater.vaillant_<water heater id>`, basically `water_heater.vaillant_control_dhw`
Expand Down
23 changes: 0 additions & 23 deletions vaillant/.translations/fr.json

This file was deleted.

36 changes: 19 additions & 17 deletions vaillant/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
QuickMode,
Room,
SystemInfo,
OperatingModes,
SettingModes,
QuickModes
)

from homeassistant.components.binary_sensor import (
Expand All @@ -22,17 +25,17 @@
DEVICE_CLASS_PROBLEM,
DEVICE_CLASS_WINDOW,
DOMAIN,
BinarySensorDevice,
BinarySensorEntity,
)
from homeassistant.util import Throttle

from . import ApiHub
from .const import DEFAULT_SCAN_INTERVAL, DOMAIN as VAILLANT
from .entities import (
VaillantBoilerDevice,
VaillantBoxDevice,
VaillantBoilerEntity,
VaillantBoxEntity,
VaillantEntity,
VaillantRoomDevice,
VaillantRoomEntity,
)

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -79,7 +82,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
return True


class CirculationSensor(VaillantEntity, BinarySensorDevice):
class CirculationSensor(VaillantEntity, BinarySensorEntity):
"""Binary sensor for circulation running on or not."""

def __init__(self, circulation: Circulation):
Expand All @@ -93,7 +96,6 @@ def __init__(self, circulation: Circulation):
@property
def is_on(self):
"""Return true if the binary sensor is on."""
from pymultimatic.model import OperatingModes, SettingModes, QuickModes

return (
self._active_mode.current == OperatingModes.ON
Expand All @@ -112,7 +114,7 @@ async def vaillant_update(self):
self._active_mode = self.hub.system.get_active_mode_circulation()


class RoomWindow(VaillantEntity, BinarySensorDevice):
class RoomWindow(VaillantEntity, BinarySensorEntity):
"""Vaillant window binary sensor."""

def __init__(self, room: Room):
Expand Down Expand Up @@ -143,13 +145,13 @@ async def vaillant_update(self):
self._room = new_room


class RoomDevice(VaillantEntity, VaillantRoomDevice, BinarySensorDevice, ABC):
class RoomDevice(VaillantEntity, VaillantRoomEntity, BinarySensorEntity, ABC):
"""Base class for device in room."""

def __init__(self, device: Device, room: Room, device_class):
"""Initialize entity."""
VaillantEntity.__init__(self, DOMAIN, device_class, device.sgtin, device.name)
VaillantRoomDevice.__init__(self, device)
VaillantRoomEntity.__init__(self, device)
self._room = room
self._device_class = device_class

Expand Down Expand Up @@ -186,7 +188,7 @@ async def vaillant_update(self):
self.device = new_device


class RoomDeviceChildLock(RoomDevice, BinarySensorDevice):
class RoomDeviceChildLock(RoomDevice, BinarySensorEntity):
"""Binary sensor for valve child lock.
At vaillant API, the lock is set at a room level, but it applies to all
Expand Down Expand Up @@ -247,13 +249,13 @@ def is_on(self):
return not self.device.radio_out_of_reach


class BaseVaillantSystem(VaillantEntity, VaillantBoxDevice, BinarySensorDevice):
class BaseVaillantSystem(VaillantEntity, VaillantBoxEntity, BinarySensorEntity):
"""Base class for system wide binary sensor."""

def __init__(self, info: SystemInfo, device_class, name, comp_id):
"""Initialize entity."""
VaillantEntity.__init__(self, DOMAIN, device_class, name, comp_id, False)
VaillantBoxDevice.__init__(self, info)
VaillantBoxEntity.__init__(self, info)

@property
def available(self):
Expand Down Expand Up @@ -303,7 +305,7 @@ def is_on(self):
return self.system_info.is_online


class BoilerError(VaillantEntity, BinarySensorDevice, VaillantBoilerDevice):
class BoilerError(VaillantEntity, BinarySensorEntity, VaillantBoilerEntity):
"""Check if there is some error."""

def __init__(self, boiler_status: BoilerStatus):
Expand All @@ -316,7 +318,7 @@ def __init__(self, boiler_status: BoilerStatus):
boiler_status.device_name,
False,
)
VaillantBoilerDevice.__init__(self, boiler_status)
VaillantBoilerEntity.__init__(self, boiler_status)
self._state_attrs = {}

@property
Expand Down Expand Up @@ -365,7 +367,7 @@ async def _update(self):
self._async_add_entities(sensors)


class VaillantSystemError(VaillantEntity, BinarySensorDevice):
class VaillantSystemError(VaillantEntity, BinarySensorEntity):
"""Check if there is any error message from system."""

def __init__(self, error: Error):
Expand Down Expand Up @@ -418,7 +420,7 @@ def is_on(self):
return True


class HolidayModeSensor(VaillantEntity, BinarySensorDevice):
class HolidayModeSensor(VaillantEntity, BinarySensorEntity):
"""Binary sensor for holiday mode."""

def __init__(self, holiday_mode: HolidayMode):
Expand Down Expand Up @@ -447,7 +449,7 @@ async def vaillant_update(self):
self._holiday = self.hub.system.holiday


class QuickModeSensor(VaillantEntity, BinarySensorDevice):
class QuickModeSensor(VaillantEntity, BinarySensorEntity):
"""Binary sensor for holiday mode."""

def __init__(self, quick_mode: QuickMode):
Expand Down
11 changes: 2 additions & 9 deletions vaillant/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Zone,
)

from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
DOMAIN,
HVAC_MODE_AUTO,
Expand Down Expand Up @@ -57,7 +57,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
return True


class VaillantClimate(VaillantEntity, ClimateDevice, abc.ABC):
class VaillantClimate(VaillantEntity, ClimateEntity, abc.ABC):
"""Base class for climate."""

def __init__(self, system: System, comp_name, comp_id, component: Component):
Expand All @@ -71,7 +71,6 @@ def __init__(self, system: System, comp_name, comp_id, component: Component):
@abc.abstractmethod
def active_mode(self) -> ActiveMode:
"""Get active mode of the climate."""
pass

@property
def listening(self):
Expand Down Expand Up @@ -126,23 +125,18 @@ def swing_modes(self) -> Optional[List[str]]:

def set_humidity(self, humidity: int) -> None:
"""Set new target humidity."""
pass

def set_fan_mode(self, fan_mode: str) -> None:
"""Set new target fan mode."""
pass

def set_swing_mode(self, swing_mode: str) -> None:
"""Set new target swing operation."""
pass

def turn_aux_heat_on(self) -> None:
"""Turn auxiliary heater on."""
pass

def turn_aux_heat_off(self) -> None:
"""Turn auxiliary heater off."""
pass

@property
def target_temperature_high(self) -> Optional[float]:
Expand Down Expand Up @@ -190,7 +184,6 @@ def _is_heating(self):
@abc.abstractmethod
def mode_to_hvac(self, mode):
"""Get the hvac mode based on vaillant mode."""
pass


class RoomClimate(VaillantClimate):
Expand Down
14 changes: 12 additions & 2 deletions vaillant/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Config flow for vaillant integration."""
import logging

from pymultimatic.api import ApiError
import voluptuous as vol

from homeassistant import config_entries, core, exceptions
Expand Down Expand Up @@ -36,8 +37,17 @@ async def validate_input(hass: core.HomeAssistant, data):
async def validate_authentication(hass, username, password, serial):
"""Ensure provided credentials are working."""
hub: ApiHub = ApiHub(hass, username, password, serial)
if not await hub.authenticate():
raise InvalidAuth
try:
if not await hub.authenticate():
raise InvalidAuth
except ApiError as err:
resp = await err.response.json()
_LOGGER.exception(
"Unable to authenticate, API says: %s, status: %s",
resp,
err.response.status,
)
raise InvalidAuth from err


class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
Expand Down
7 changes: 3 additions & 4 deletions vaillant/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def device_class(self):
@abstractmethod
async def vaillant_update(self):
"""Update specific for vaillant."""
pass

@property
def listening(self):
Expand All @@ -76,7 +75,7 @@ async def async_will_remove_from_hass(self) -> None:
self.hass.data[DOMAIN].entities.remove(self)


class VaillantBoilerDevice(Entity):
class VaillantBoilerEntity(Entity):
"""Base class for boiler device."""

def __init__(self, boiler_status: BoilerStatus) -> None:
Expand Down Expand Up @@ -105,7 +104,7 @@ def device_state_attributes(self):
return None


class VaillantRoomDevice(Entity):
class VaillantRoomEntity(Entity):
"""Base class for ambisense device."""

def __init__(self, device: Device) -> None:
Expand All @@ -132,7 +131,7 @@ def device_state_attributes(self):
}


class VaillantBoxDevice(Entity):
class VaillantBoxEntity(Entity):
"""Vaillant gateway device (ex: VR920)."""

def __init__(self, info: SystemInfo):
Expand Down
Loading

0 comments on commit 35ba756

Please sign in to comment.