mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add PRESET_AWAY to HomematicIP Cloud climate (#25641)
* enable climate away_mode and home.refresh * Add Party eco modes
This commit is contained in:
parent
93dfd613aa
commit
73f5575708
@ -5,16 +5,19 @@ from typing import Awaitable
|
|||||||
from homematicip.aio.device import AsyncHeatingThermostat, AsyncHeatingThermostatCompact
|
from homematicip.aio.device import AsyncHeatingThermostat, AsyncHeatingThermostatCompact
|
||||||
from homematicip.aio.group import AsyncHeatingGroup
|
from homematicip.aio.group import AsyncHeatingGroup
|
||||||
from homematicip.aio.home import AsyncHome
|
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 import ClimateDevice
|
||||||
from homeassistant.components.climate.const import (
|
from homeassistant.components.climate.const import (
|
||||||
HVAC_MODE_AUTO,
|
HVAC_MODE_AUTO,
|
||||||
HVAC_MODE_HEAT,
|
HVAC_MODE_HEAT,
|
||||||
|
PRESET_AWAY,
|
||||||
PRESET_BOOST,
|
PRESET_BOOST,
|
||||||
PRESET_ECO,
|
PRESET_ECO,
|
||||||
|
PRESET_NONE,
|
||||||
SUPPORT_PRESET_MODE,
|
SUPPORT_PRESET_MODE,
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
SUPPORT_TARGET_TEMPERATURE,
|
||||||
PRESET_NONE,
|
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
|
||||||
@ -116,9 +119,17 @@ class HomematicipHeatingGroup(HomematicipGenericDevice, ClimateDevice):
|
|||||||
if self._device.boostMode:
|
if self._device.boostMode:
|
||||||
return PRESET_BOOST
|
return PRESET_BOOST
|
||||||
if self._device.controlMode == HMIP_ECO_CM:
|
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
|
@property
|
||||||
def preset_modes(self):
|
def preset_modes(self):
|
||||||
|
@ -110,10 +110,13 @@ class HomematicipHAP:
|
|||||||
|
|
||||||
Triggered when the HMIP HOME_CHANGED event has fired.
|
Triggered when the HMIP HOME_CHANGED event has fired.
|
||||||
There are several occasions for this event to happen.
|
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
|
is still connected. If not, device state changes cannot
|
||||||
be forwarded to hass. So if access point is disconnected all devices
|
be forwarded to hass. So if access point is disconnected all devices
|
||||||
are set to unavailable.
|
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:
|
if not self.home.connected:
|
||||||
_LOGGER.error("HMIP access point has lost connection with the cloud")
|
_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 = self.hass.async_create_task(self.get_state())
|
||||||
job.add_done_callback(self.get_state_finished)
|
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):
|
async def get_state(self):
|
||||||
"""Update HMIP state and tell Home Assistant."""
|
"""Update HMIP state and tell Home Assistant."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user