Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Intergas InComfort Lan2RF gateway #23736

Merged
merged 40 commits into from May 7, 2019
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
d98ef86
fixed __init__.py
zxdavb Apr 29, 2019
21bacd9
add sensors
zxdavb Apr 30, 2019
efb697f
switch to parent-child architecture
zxdavb Apr 30, 2019
1f5ceec
make binary_sensor the parent
zxdavb May 1, 2019
acf823a
revert parent - to water_heater
zxdavb May 1, 2019
9ee6a78
first working version
zxdavb May 1, 2019
8f33f91
working, delinted (except TODO)
zxdavb May 1, 2019
045cd30
update to latest client library
zxdavb May 1, 2019
590c53f
remove debug code
zxdavb May 1, 2019
5f68d26
delint
zxdavb May 1, 2019
b22a8a3
Merge remote-tracking branch 'upstream/dev' into add_intergas_intouch
zxdavb May 1, 2019
521f0f2
tweak device_state_attributes
zxdavb May 1, 2019
c0adc37
tweak device_state_attrbutes
zxdavb May 1, 2019
97fc989
minor tweaks
zxdavb May 1, 2019
40a1cef
bump client library for bugfix
zxdavb May 1, 2019
dc6de80
improve state attributes for pumping
zxdavb May 1, 2019
6304809
update .coverage
zxdavb May 1, 2019
d1845a1
bugfix - binary sensors not updating
zxdavb May 1, 2019
cfc2827
rename to incomfort from intouch
zxdavb May 2, 2019
691a4f5
fix coveragerc regression
zxdavb May 6, 2019
deaf2b0
Merge remote-tracking branch 'upstream/dev' into add_intergas_intouch
zxdavb May 6, 2019
c21f080
Merge remote-tracking branch 'upstream/dev' into add_intergas_intouch
zxdavb May 6, 2019
72c0532
bump client (bugfix for /protected URL)
zxdavb May 6, 2019
228dc67
bump client (bugfix for /protected URL) 2
zxdavb May 7, 2019
ac1e428
bump client
zxdavb May 7, 2019
2fac73e
remove debug code
zxdavb May 7, 2019
5a380a2
ready for PR
zxdavb May 7, 2019
afcd0de
fix regression
zxdavb May 7, 2019
3dd5391
use xx._boiler instead of xx._objref
zxdavb May 7, 2019
e9eefc2
improve current_temperature and delint
zxdavb May 7, 2019
5978615
use current_operation instead of state
zxdavb May 7, 2019
f7ab847
refactor vol.Schema
zxdavb May 7, 2019
59ef9f4
remove unneeded instance attribute
zxdavb May 7, 2019
ec43141
remove unneeded instance attribute 2
zxdavb May 7, 2019
3e4d6ab
refactor device_state_attributes
zxdavb May 7, 2019
97786c3
change 'boiler' to 'heater'
zxdavb May 7, 2019
79212f5
change 'boiler' to 'heater' 2
zxdavb May 7, 2019
7607be9
correct a typo
zxdavb May 7, 2019
05388b7
bugfix: add missing comma
zxdavb May 7, 2019
895ddd3
small tidy-up
zxdavb May 7, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Expand Up @@ -278,6 +278,7 @@ omit =
homeassistant/components/imap_email_content/sensor.py
homeassistant/components/influxdb/sensor.py
homeassistant/components/insteon/*
homeassistant/components/incomfort/*
homeassistant/components/ios/*
homeassistant/components/iota/*
homeassistant/components/iperf3/*
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Expand Up @@ -112,6 +112,7 @@ homeassistant/components/huawei_lte/* @scop
homeassistant/components/huawei_router/* @abmantis
homeassistant/components/hue/* @balloob
homeassistant/components/ign_sismologia/* @exxamalte
homeassistant/components/incomfort/* @zxdavb
homeassistant/components/influxdb/* @fabaff
homeassistant/components/input_boolean/* @home-assistant/core
homeassistant/components/input_datetime/* @home-assistant/core
Expand Down
57 changes: 57 additions & 0 deletions homeassistant/components/incomfort/__init__.py
@@ -0,0 +1,57 @@
"""Support for an Intergas boiler via an InComfort/Intouch Lan2RF gateway."""
import logging

import voluptuous as vol
from incomfortclient import Gateway as InComfortGateway

from homeassistant.const import (
CONF_HOST, CONF_PASSWORD, CONF_USERNAME)
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.discovery import async_load_platform

_LOGGER = logging.getLogger(__name__)

DOMAIN = 'incomfort'

_V1_SCHEMA = vol.Schema({
vol.Required(CONF_HOST): cv.string,
})
_V2_SCHEMA = vol.Schema({
vol.Required(CONF_HOST): cv.string,
vol.Required(CONF_USERNAME): cv.string,
zxdavb marked this conversation as resolved.
Show resolved Hide resolved
vol.Required(CONF_PASSWORD): cv.string,
zxdavb marked this conversation as resolved.
Show resolved Hide resolved
})
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Any(
_V1_SCHEMA,
_V2_SCHEMA,
)
}, extra=vol.ALLOW_EXTRA)


async def async_setup(hass, hass_config):
"""Create an Intergas InComfort/Intouch system."""
incomfort_data = hass.data[DOMAIN] = {}

credentials = dict(hass_config[DOMAIN])
hostname = credentials.pop(CONF_HOST)

try:
client = incomfort_data['client'] = InComfortGateway(
hostname, **credentials, session=async_get_clientsession(hass)
)

heater = incomfort_data['heater'] = list(await client.heaters)[0]
await heater.update()

except AssertionError: # assert response.status == HTTP_OK
_LOGGER.warning(
"setup(): Failed, check your configuration.",
zxdavb marked this conversation as resolved.
Show resolved Hide resolved
exc_info=True)
return False

hass.async_create_task(async_load_platform(
hass, 'water_heater', DOMAIN, {}, hass_config))

return True
12 changes: 12 additions & 0 deletions homeassistant/components/incomfort/manifest.json
@@ -0,0 +1,12 @@
{
"domain": "incomfort",
"name": "Intergas InComfort/Intouch Lan2RF gateway",
"documentation": "https://www.home-assistant.io/components/incomfort",
"requirements": [
"incomfort-client==0.2.8"
],
"dependencies": [],
"codeowners": [
"@zxdavb"
]
}
96 changes: 96 additions & 0 deletions homeassistant/components/incomfort/water_heater.py
@@ -0,0 +1,96 @@
"""Support for an Intergas boiler via an InComfort/Intouch Lan2RF gateway."""
import asyncio
import logging

from homeassistant.components.water_heater import WaterHeaterDevice
from homeassistant.const import TEMP_CELSIUS

from . import DOMAIN

_LOGGER = logging.getLogger(__name__)

INCOMFORT_SUPPORT_FLAGS = 0

INCOMFORT_MAX_TEMP = 80.0
INCOMFORT_MIN_TEMP = 30.0


async def async_setup_platform(hass, hass_config, async_add_entities,
discovery_info=None):
"""Set up an InComfort/Intouch water_heater device."""
client = hass.data[DOMAIN]['client']
heater = hass.data[DOMAIN]['heater']

async_add_entities([
IncomfortWaterHeater(client, heater)], update_before_add=True)


class IncomfortWaterHeater(WaterHeaterDevice):
"""Representation of an InComfort/Intouch water_heater device."""

def __init__(self, client, boiler):
"""Initialize the water_heater device."""
self._client = client
self._objref = boiler
self._name = 'Boiler'
zxdavb marked this conversation as resolved.
Show resolved Hide resolved

@property
def name(self):
"""Return the name of the water_heater device."""
return self._name

@property
def device_state_attributes(self):
"""Return the device state attributes."""
keys = ['nodenr', 'rf_message_rssi', 'rfstatus_cntr', 'room_1',
'room_2']
state = {k: self._objref.status[k]
for k in self._objref.status if k not in keys}
return {'status': state}
zxdavb marked this conversation as resolved.
Show resolved Hide resolved

@property
def current_temperature(self):
"""Return the current temperature."""
return self._objref.heater_temp # or: self._objref.tap_temp?

@property
def min_temp(self):
"""Return max valid temperature that can be set."""
return INCOMFORT_MIN_TEMP

@property
def max_temp(self):
"""Return max valid temperature that can be set."""
return INCOMFORT_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 INCOMFORT_SUPPORT_FLAGS

@property
def state(self):
zxdavb marked this conversation as resolved.
Show resolved Hide resolved
"""Return the current operation mode."""
if self._objref.is_failed:
return "Failed ({})".format(self._objref.fault_code)

return self._objref.display_text

@property
def should_poll(self) -> bool:
"""Return True as this device should always be polled."""
return True
zxdavb marked this conversation as resolved.
Show resolved Hide resolved

async def async_update(self):
"""Get the latest state data from the gateway."""
try:
await self._objref.update()

except (AssertionError, asyncio.TimeoutError) as err:
_LOGGER.warning("Update for %s failed, message: %s",
self._name, err)
3 changes: 3 additions & 0 deletions requirements_all.txt
Expand Up @@ -601,6 +601,9 @@ iglo==1.2.7
# homeassistant.components.ihc
ihcsdk==2.3.0

# homeassistant.components.incomfort
incomfort-client==0.2.8

# homeassistant.components.influxdb
influxdb==5.2.0

Expand Down