Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions homeassistant/components/homematicip_cloud/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
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
Expand Down Expand Up @@ -116,9 +119,17 @@ def preset_mode(self):
if self._device.boostMode:
return PRESET_BOOST
if self._device.controlMode == HMIP_ECO_CM:
return PRESET_ECO

return None
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
Comment thread
SukramJ marked this conversation as resolved.
Outdated

return PRESET_NONE

@property
def preset_modes(self):
Expand Down
11 changes: 10 additions & 1 deletion homeassistant/components/homematicip_cloud/hap.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,13 @@ def async_update(self, *args, **kwargs):

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")
Expand All @@ -127,6 +130,12 @@ def async_update(self, *args, **kwargs):

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."""
Expand Down