diff --git a/custom_components/multimatic/binary_sensor.py b/custom_components/multimatic/binary_sensor.py index 943791b..d65006f 100644 --- a/custom_components/multimatic/binary_sensor.py +++ b/custom_components/multimatic/binary_sensor.py @@ -18,6 +18,7 @@ from homeassistant.util import slugify from .const import ( + ATTR_DURATION, DHW, DOMAIN as MULTIMATIC, FACILITY_DETAIL, @@ -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): diff --git a/custom_components/multimatic/climate.py b/custom_components/multimatic/climate.py index 975ae58..7fc61a7 100644 --- a/custom_components/multimatic/climate.py +++ b/custom_components/multimatic/climate.py @@ -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 = { @@ -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) @@ -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} ) @@ -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]: diff --git a/custom_components/multimatic/coordinator.py b/custom_components/multimatic/coordinator.py index d6b1e52..831aead 100644 --- a/custom_components/multimatic/coordinator.py +++ b/custom_components/multimatic/coordinator.py @@ -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): diff --git a/custom_components/multimatic/manifest.json b/custom_components/multimatic/manifest.json index 1adb776..5defb0a 100644 --- a/custom_components/multimatic/manifest.json +++ b/custom_components/multimatic/manifest.json @@ -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": [], @@ -14,6 +14,6 @@ "codeowners": [ "@thomasgermain" ], - "version": "1.7.0b3", + "version": "1.7.0b4", "iot_class": "cloud_polling" } diff --git a/custom_components/multimatic/sensor.py b/custom_components/multimatic/sensor.py index d22e17b..e2a6d85 100644 --- a/custom_components/multimatic/sensor.py +++ b/custom_components/multimatic/sensor.py @@ -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