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

Commit

Permalink
1.7.0b3
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasgermain committed Jun 30, 2021
1 parent 4de17d6 commit b056f11
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion custom_components/multimatic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
update_interval=update_interval,
)
hass.data[DOMAIN][entry.unique_id][COORDINATORS][coord[0]] = m_coord
await m_coord.async_config_entry_first_refresh()
_LOGGER.debug("Adding %s coordinator", m_coord.name)
await m_coord.async_config_entry_first_refresh()

for platform in PLATFORMS:
hass.async_create_task(
Expand Down
5 changes: 5 additions & 0 deletions custom_components/multimatic/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ def device(self):
return device
return None

@property
def name(self) -> str | None:
"""Return the name of the entity."""
return f"{self.device.name} {self.device_class}"


class RoomDeviceChildLock(RoomDeviceEntity):
"""Binary sensor for valve child lock.
Expand Down
16 changes: 11 additions & 5 deletions custom_components/multimatic/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,12 @@ async def set_holiday_mode(self, start_date, end_date, temperature):
self._holiday_mode = HolidayMode(True, start_date, end_date, temperature)
await self._refresh_entities()

async def set_quick_mode(self, mode):
async def set_quick_mode(self, mode, duration):
"""Set quick mode (remove previous one)."""
await self._remove_quick_mode_no_refresh()
qmode = QuickModes.get(mode)
if duration is None and mode == QuickModes.COOLING_FOR_X_DAYS.name:
duration = 1
qmode = QuickModes.get(mode, duration)
await self._manager.set_quick_mode(qmode)
self._quick_mode = qmode
await self._refresh_entities()
Expand Down Expand Up @@ -501,9 +503,13 @@ async def _fetch_data_if_needed(self):
return await self._fetch_data()

async def _first_fetch_data(self):
result = await self._fetch_data()
self.update_method = self._fetch_data_if_needed
return result
try:
result = await self._fetch_data()
self.update_method = self._fetch_data_if_needed
return result
except ApiError as err:
if err.status != 409:
raise

async def _safe_logout(self):
try:
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.0b0"
"pymultimatic==0.5.0b1"
],
"ssdp": [],
"zeroconf": [],
Expand All @@ -14,6 +14,6 @@
"codeowners": [
"@thomasgermain"
],
"version": "1.7.0b2",
"version": "1.7.0b3",
"iot_class": "cloud_polling"
}
10 changes: 8 additions & 2 deletions custom_components/multimatic/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@
{vol.Required(ATTR_ENTITY_ID): vol.All(vol.Coerce(str))}
)
SERVICE_SET_QUICK_MODE_SCHEMA = vol.Schema(
{vol.Required(ATTR_QUICK_MODE): vol.All(vol.Coerce(str), vol.In(QUICK_MODES_LIST))}
{
vol.Required(ATTR_QUICK_MODE): vol.All(
vol.Coerce(str), vol.In(QUICK_MODES_LIST)
),
vol.Optional(ATTR_DURATION): vol.All(vol.Coerce(int), vol.Clamp(min=1)),
}
)
SERVICE_SET_HOLIDAY_MODE_SCHEMA = vol.Schema(
{
Expand Down Expand Up @@ -120,7 +125,8 @@ async def remove_holiday_mode(self, data):
async def set_quick_mode(self, data):
"""Set quick mode, it may impact the whole system."""
quick_mode = data.get(ATTR_QUICK_MODE, None)
await self.api.set_quick_mode(quick_mode)
duration = data.get(ATTR_DURATION, None)
await self.api.set_quick_mode(quick_mode, duration)

async def request_hvac_update(self, data):
"""Ask multimatic API to get data from the installation."""
Expand Down
3 changes: 3 additions & 0 deletions custom_components/multimatic/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ set_quick_mode:
quick_mode:
description: Name of the quick mode (required)
example: QM_HOTWATER_BOOST, QM_VENTILATION_BOOST, QM_ONE_DAY_AWAY, QM_SYSTEM_OFF, QM_ONE_DAY_AT_HOME, QM_PARTY
duration:
description: (int) number of days the quick mode should last
example: 3

set_holiday_mode:
description: Set holiday mode
Expand Down

0 comments on commit b056f11

Please sign in to comment.