Add PRESET_AWAY to HomematicIP Cloud climate (#25641)
* enable climate away_mode and home.refresh * Add Party eco modespull/25756/head
parent
8d1deef9cc
commit
e001b12430
|
@ -5,16 +5,19 @@ from typing import Awaitable
|
|||
from homematicip.aio.device import AsyncHeatingThermostat, AsyncHeatingThermostatCompact
|
||||
from homematicip.aio.group import AsyncHeatingGroup
|
||||
from homematicip.aio.home import AsyncHome
|
||||
from homematicip.base.enums import AbsenceType
|
||||
from homematicip.functionalHomes import IndoorClimateHome
|
||||
|
||||
from homeassistant.components.climate import ClimateDevice
|
||||
from homeassistant.components.climate.const import (
|
||||
HVAC_MODE_AUTO,
|
||||
HVAC_MODE_HEAT,
|
||||
PRESET_AWAY,
|
||||
PRESET_BOOST,
|
||||
PRESET_ECO,
|
||||
PRESET_NONE,
|
||||
SUPPORT_PRESET_MODE,
|
||||
SUPPORT_TARGET_TEMPERATURE,
|
||||
PRESET_NONE,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
||||
|
@ -116,9 +119,17 @@ class HomematicipHeatingGroup(HomematicipGenericDevice, ClimateDevice):
|
|||
if self._device.boostMode:
|
||||
return PRESET_BOOST
|
||||
if self._device.controlMode == HMIP_ECO_CM:
|
||||
return PRESET_ECO
|
||||
absence_type = self._home.get_functionalHome(IndoorClimateHome).absenceType
|
||||
if absence_type == AbsenceType.VACATION:
|
||||
return PRESET_AWAY
|
||||
if absence_type in [
|
||||
AbsenceType.PERIOD,
|
||||
AbsenceType.PERMANENT,
|
||||
AbsenceType.PARTY,
|
||||
]:
|
||||
return PRESET_ECO
|
||||
|
||||
return None
|
||||
return PRESET_NONE
|
||||
|
||||
@property
|
||||
def preset_modes(self):
|
||||
|
|
|
@ -110,10 +110,13 @@ class HomematicipHAP:
|
|||
|
||||
Triggered when the HMIP HOME_CHANGED event has fired.
|
||||
There are several occasions for this event to happen.
|
||||
We are only interested to check whether the access point
|
||||
1. We are interested to check whether the access point
|
||||
is still connected. If not, device state changes cannot
|
||||
be forwarded to hass. So if access point is disconnected all devices
|
||||
are set to unavailable.
|
||||
2. We need to update home including devices and groups after a reconnect.
|
||||
3. We need to update home without devices and groups in all other cases.
|
||||
|
||||
"""
|
||||
if not self.home.connected:
|
||||
_LOGGER.error("HMIP access point has lost connection with the cloud")
|
||||
|
@ -127,6 +130,12 @@ class HomematicipHAP:
|
|||
|
||||
job = self.hass.async_create_task(self.get_state())
|
||||
job.add_done_callback(self.get_state_finished)
|
||||
self._accesspoint_connected = True
|
||||
else:
|
||||
# Update home with the given json from arg[0],
|
||||
# without devices and groups.
|
||||
|
||||
self.home.update_home_only(args[0])
|
||||
|
||||
async def get_state(self):
|
||||
"""Update HMIP state and tell Home Assistant."""
|
||||
|
|
Loading…
Reference in New Issue