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

Commit

Permalink
1.7.0b4
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasgermain committed Jul 6, 2021
1 parent b056f11 commit d943739
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
7 changes: 6 additions & 1 deletion custom_components/multimatic/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from homeassistant.util import slugify

from .const import (
ATTR_DURATION,
DHW,
DOMAIN as MULTIMATIC,
FACILITY_DETAIL,
Expand Down Expand Up @@ -517,8 +518,12 @@ def is_on(self):
@property
def state_attributes(self):
"""Return the state attributes."""
attrs = {}
if self.is_on:
return {"quick_mode": self.coordinator.data.name}
attrs = {"quick_mode": self.coordinator.data.name}
if self.coordinator.data.duration:
attrs.update({ATTR_DURATION: self.coordinator.data.duration})
return attrs

@property
def name(self):
Expand Down
8 changes: 5 additions & 3 deletions custom_components/multimatic/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ class ZoneClimate(MultimaticClimate):
HVAC_MODE_AUTO: OperatingModes.AUTO,
HVAC_MODE_OFF: OperatingModes.OFF,
HVAC_MODE_FAN_ONLY: QuickModes.VENTILATION_BOOST,
HVAC_MODE_COOL: QuickModes.COOLING_FOR_X_DAYS,
}

_HA_PRESET_TO_MULTIMATIC = {
Expand All @@ -396,6 +397,7 @@ def __init__(
if not zone.cooling:
self._supported_presets.remove(PRESET_COOLING_ON)
self._supported_presets.remove(PRESET_COOLING_FOR_X_DAYS)
self._supported_hvac.remove(HVAC_MODE_COOL)

if not ventilation:
self._supported_hvac.remove(HVAC_MODE_FAN_ONLY)
Expand All @@ -406,7 +408,7 @@ def __init__(
def extra_state_attributes(self) -> Mapping[str, Any] | None:
"""Return entity specific state attributes."""
attr = {}
if self.active_mode == QuickModes.COOLING_FOR_X_DAYS:
if self.active_mode.current == QuickModes.COOLING_FOR_X_DAYS:
attr.update(
{"cooling_for_x_days_duration": self.active_mode.current.duration}
)
Expand Down Expand Up @@ -435,11 +437,11 @@ def hvac_mode(self):
):
return HVAC_MODE_HEAT
if (
self.preset_mode == PRESET_COOLING_ON
self.preset_mode in (PRESET_COOLING_ON, PRESET_COOLING_FOR_X_DAYS)
and self.hvac_action == CURRENT_HVAC_COOL
):
return HVAC_MODE_COOL
return hvac_mode
return hvac_mode if hvac_mode else HVAC_MODE_OFF

@property
def hvac_modes(self) -> list[str]:
Expand Down
11 changes: 10 additions & 1 deletion custom_components/multimatic/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,16 @@ async def _first_fetch_data(self):
self.update_method = self._fetch_data_if_needed
return result
except ApiError as err:
if err.status != 409:
if err.status in (400, 409):
self.update_method = self._fetch_data_if_needed
_LOGGER.debug(
"Received %s %s when calling %s for the first time",
err.response,
err.message,
self.name,
exc_info=True,
)
else:
raise

async def _safe_logout(self):
Expand Down
4 changes: 2 additions & 2 deletions custom_components/multimatic/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"documentation": "https://github.com/thomasgermain/vaillant-component",
"issue_tracker": "https://github.com/thomasgermain/vaillant-component/issues",
"requirements": [
"pymultimatic==0.5.0b1"
"pymultimatic==0.5.0b2"
],
"ssdp": [],
"zeroconf": [],
Expand All @@ -14,6 +14,6 @@
"codeowners": [
"@thomasgermain"
],
"version": "1.7.0b3",
"version": "1.7.0b4",
"iot_class": "cloud_polling"
}
1 change: 1 addition & 0 deletions custom_components/multimatic/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def device_info(self):
"identifiers": {(DOMAIN, self._device_id)},
"name": self._device_name,
"manufacturer": "Vaillant",
"model": self.report.device_id,
}

@property
Expand Down

0 comments on commit d943739

Please sign in to comment.