Add incomfort climate and bump client (#23830)

* Initial commit

* bump client for bugfix

* bump client for bugfix 2

* de-lint
pull/23761/head
David Bonnes 2019-05-12 12:40:10 +01:00 committed by Martin Hjelmare
parent 3ec4070d8c
commit 2a9fd9ae26
4 changed files with 98 additions and 4 deletions

View File

@ -44,7 +44,8 @@ async def async_setup(hass, hass_config):
exc_info=True)
return False
hass.async_create_task(async_load_platform(
hass, 'water_heater', DOMAIN, {}, hass_config))
for platform in ['water_heater', 'climate']:
hass.async_create_task(async_load_platform(
hass, platform, DOMAIN, {}, hass_config))
return True

View File

@ -0,0 +1,93 @@
"""Support for an Intergas boiler via an InComfort/InTouch Lan2RF gateway."""
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import SUPPORT_TARGET_TEMPERATURE
from homeassistant.const import (ATTR_TEMPERATURE, TEMP_CELSIUS)
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from . import DOMAIN
INTOUCH_SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE
INTOUCH_MAX_TEMP = 30.0
INTOUCH_MIN_TEMP = 5.0
async def async_setup_platform(hass, hass_config, async_add_entities,
discovery_info=None):
"""Set up an InComfort/InTouch climate device."""
client = hass.data[DOMAIN]['client']
heater = hass.data[DOMAIN]['heater']
rooms = [InComfortClimate(client, r)
for r in heater.rooms if not r.room_temp]
if rooms:
async_add_entities(rooms)
class InComfortClimate(ClimateDevice):
"""Representation of an InComfort/InTouch climate device."""
def __init__(self, client, room):
"""Initialize the climate device."""
self._client = client
self._room = room
self._name = 'Room {}'.format(room.room_no)
async def async_added_to_hass(self):
"""Set up a listener when this entity is added to HA."""
async_dispatcher_connect(self.hass, DOMAIN, self._refresh)
@callback
def _refresh(self):
self.async_schedule_update_ha_state(force_refresh=True)
@property
def name(self):
"""Return the name of the climate device."""
return self._name
@property
def device_state_attributes(self):
"""Return the device state attributes."""
return {'status': self._room.status}
@property
def current_temperature(self):
"""Return the current temperature."""
return self._room.room_temp
@property
def target_temperature(self):
"""Return the temperature we try to reach."""
return self._room.override
@property
def min_temp(self):
"""Return max valid temperature that can be set."""
return INTOUCH_MIN_TEMP
@property
def max_temp(self):
"""Return max valid temperature that can be set."""
return INTOUCH_MAX_TEMP
@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 INTOUCH_SUPPORT_FLAGS
async def async_set_temperature(self, **kwargs):
"""Set a new target temperature for this zone."""
temperature = kwargs.get(ATTR_TEMPERATURE)
await self._room.set_override(temperature)
@property
def should_poll(self) -> bool:
"""Return False as this device should never be polled."""
return False

View File

@ -3,7 +3,7 @@
"name": "Intergas InComfort/Intouch Lan2RF gateway",
"documentation": "https://www.home-assistant.io/components/incomfort",
"requirements": [
"incomfort-client==0.2.8"
"incomfort-client==0.2.9"
],
"dependencies": [],
"codeowners": [

View File

@ -602,7 +602,7 @@ iglo==1.2.7
ihcsdk==2.3.0
# homeassistant.components.incomfort
incomfort-client==0.2.8
incomfort-client==0.2.9
# homeassistant.components.influxdb
influxdb==5.2.0