Add homematicip cloud climate platform (#14388)

* Add support for climatic devices

* Update requirements_all

* Change icon to mdi:thermostat

* Update of homematicip-rest-api lib version

* Remove all mode or state relevant things - will come later

* Add current_operation again to see proper status

* Remove STATE_PERFORMANCE import

* Remove trailing whitespace

* Update requirements file
This commit is contained in:
Mattias Welponer 2018-05-26 16:03:53 +02:00 committed by Martin Hjelmare
parent 41fc44b27c
commit 7ea25cd360
3 changed files with 105 additions and 3 deletions

View File

@ -0,0 +1,101 @@
"""
Support for HomematicIP climate.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/climate.homematicip_cloud/
"""
import logging
from homeassistant.components.climate import (
ClimateDevice, SUPPORT_TARGET_TEMPERATURE, ATTR_TEMPERATURE,
STATE_AUTO, STATE_MANUAL)
from homeassistant.const import TEMP_CELSIUS
from homeassistant.components.homematicip_cloud import (
HomematicipGenericDevice, DOMAIN as HOMEMATICIP_CLOUD_DOMAIN,
ATTR_HOME_ID)
_LOGGER = logging.getLogger(__name__)
STATE_BOOST = 'Boost'
HA_STATE_TO_HMIP = {
STATE_AUTO: 'AUTOMATIC',
STATE_MANUAL: 'MANUAL',
}
HMIP_STATE_TO_HA = {value: key for key, value in HA_STATE_TO_HMIP.items()}
async def async_setup_platform(hass, config, async_add_devices,
discovery_info=None):
"""Set up the HomematicIP climate devices."""
from homematicip.group import HeatingGroup
if discovery_info is None:
return
home = hass.data[HOMEMATICIP_CLOUD_DOMAIN][discovery_info[ATTR_HOME_ID]]
devices = []
for device in home.groups:
if isinstance(device, HeatingGroup):
devices.append(HomematicipHeatingGroup(home, device))
if devices:
async_add_devices(devices)
class HomematicipHeatingGroup(HomematicipGenericDevice, ClimateDevice):
"""Representation of a MomematicIP heating group."""
def __init__(self, home, device):
"""Initialize heating group."""
device.modelType = 'Group-Heating'
super().__init__(home, device)
@property
def temperature_unit(self):
"""Return the unit of measurement."""
return TEMP_CELSIUS
@property
def supported_features(self):
"""Return the list of supported features."""
return SUPPORT_TARGET_TEMPERATURE
@property
def target_temperature(self):
"""Return the temperature we try to reach."""
return self._device.setPointTemperature
@property
def current_temperature(self):
"""Return the current temperature."""
return self._device.actualTemperature
@property
def current_humidity(self):
"""Return the current humidity."""
return self._device.humidity
@property
def current_operation(self):
"""Return current operation ie. automatic or manual."""
return HMIP_STATE_TO_HA.get(self._device.controlMode)
@property
def min_temp(self):
"""Return the minimum temperature."""
return self._device.minTemperature
@property
def max_temp(self):
"""Return the maximum temperature."""
return self._device.maxTemperature
async def async_set_temperature(self, **kwargs):
"""Set new target temperature."""
temperature = kwargs.get(ATTR_TEMPERATURE)
if temperature is None:
return
await self._device.set_point_temperature(temperature)

View File

@ -17,7 +17,7 @@ from homeassistant.helpers.discovery import async_load_platform
from homeassistant.helpers.entity import Entity
from homeassistant.core import callback
REQUIREMENTS = ['homematicip==0.9.2.4']
REQUIREMENTS = ['homematicip==0.9.4']
_LOGGER = logging.getLogger(__name__)
@ -27,7 +27,8 @@ COMPONENTS = [
'sensor',
'binary_sensor',
'switch',
'light'
'light',
'climate',
]
CONF_NAME = 'name'

View File

@ -395,7 +395,7 @@ home-assistant-frontend==20180526.1
# homekit==0.6
# homeassistant.components.homematicip_cloud
homematicip==0.9.2.4
homematicip==0.9.4
# homeassistant.components.camera.onvif
http://github.com/tgaugry/suds-passworddigest-py3/archive/86fc50e39b4d2b8997481967d6a7fe1c57118999.zip#suds-passworddigest-py3==0.1.2a