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
Changes from 1 commit
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 file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

rename to incomfort from intouch

  • Loading branch information...
zxdavb committed May 2, 2019
commit cfc2827c049bcfa9f131b12bff01947b9487341e
@@ -109,14 +109,14 @@ 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
homeassistant/components/input_number/* @home-assistant/core
homeassistant/components/input_select/* @home-assistant/core
homeassistant/components/input_text/* @home-assistant/core
homeassistant/components/integration/* @dgomes
homeassistant/components/intouch/* @zxdavb
homeassistant/components/ios/* @robbiet480
homeassistant/components/ipma/* @dgomes
homeassistant/components/iqvia/* @bachya
@@ -1,8 +1,8 @@
"""This integration connects to an Intergas Intouch Lan2RF gateway."""
"""Support for an Intergas boiler via an InComfort/Intouch Lan2RF gateway."""
import logging

import voluptuous as vol
from intouchclient import InTouchGateway
from incomfortclient import Gateway as InComfortGateway

from homeassistant.const import (
CONF_HOST, CONF_PASSWORD, CONF_USERNAME)
@@ -12,7 +12,7 @@

_LOGGER = logging.getLogger(__name__)

DOMAIN = 'intouch'
DOMAIN = 'incomfort'

_V1_SCHEMA = vol.Schema({
vol.Required(CONF_HOST): cv.string,
@@ -31,18 +31,18 @@


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

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

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

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

except AssertionError: # assert response.status == HTTP_OK
@@ -1,4 +1,4 @@
"""Support for the Sensors of an Intouch Lan2RF gateway."""
"""Support for an Intergas boiler via an InComfort/InTouch Lan2RF gateway."""
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
@@ -8,28 +8,29 @@

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

async_add_entities([
IntouchBurning(client, heater),
IntouchPumping(client, heater),
IntouchTapping(client, heater),
IntouchFailed(client, heater)
IncomfortBurning(client, heater),
IncomfortPumping(client, heater),
IncomfortTapping(client, heater),
IncomfortFailed(client, heater)
])


class IntouchBinarySensor(BinarySensorDevice):
"""Representation of an InTouch binary sensor."""
class IncomfortBinarySensor(BinarySensorDevice):
"""Representation of an InComfort/InTouch binary_sensor device."""

def __init__(self, client, boiler):
"""Initialize the binary sensor."""
self._client = client
self._objref = boiler

self._name = None
self._is_on = None
self._is_on_key = None
self._other_key = None

async def async_added_to_hass(self):
"""Set up a listener when this entity is added to HA."""
@@ -50,14 +51,22 @@ def is_on(self):
"""Return the status of the sensor."""
return self._objref.status[self._is_on_key]

@property
def device_state_attributes(self):
"""Return the device state attributes."""
if self._other_key is None:
return None
value = self._objref.status[self._other_key] if self.is_on else None
return {self._other_key: value}

@property
def should_poll(self) -> bool:
"""Return False as this device should never be polled."""
return False


class IntouchBurning(IntouchBinarySensor):
"""Representation of an InTouch Burning sensor."""
class IncomfortBurning(IncomfortBinarySensor):
"""Representation of an InComfort Burning sensor."""

def __init__(self, client, boiler):
"""Initialize the binary sensor."""
@@ -67,52 +76,37 @@ def __init__(self, client, boiler):
self._is_on_key = 'is_burning'


class IntouchFailed(IntouchBinarySensor):
"""Representation of an InTouch Failed sensor."""
class IncomfortFailed(IncomfortBinarySensor):
"""Representation of an InComfort Failed sensor."""

def __init__(self, client, boiler):
"""Initialize the binary sensor."""
super().__init__(client, boiler)

self._name = 'Failed'
self._is_on_key = 'is_failed'

@property
def device_state_attributes(self):
"""Return the device state attributes."""
fault_code = self._objref.fault_code if self.is_on else None
return {'fault_code': fault_code}
self._other_key = 'fault_code'


class IntouchPumping(IntouchBinarySensor):
"""Representation of an InTouch Pumping sensor."""
class IncomfortPumping(IncomfortBinarySensor):
"""Representation of an InComfort Pumping sensor."""

def __init__(self, client, boiler):
"""Initialize the binary sensor."""
super().__init__(client, boiler)

self._name = 'Pumping'
self._is_on_key = 'is_pumping'

@property
def device_state_attributes(self):
"""Return the device state attributes."""
heater_temp = self._objref.heater_temp if self.is_on else None
return {'heater_temp': heater_temp}
self._other_key = 'heater_temp'


class IntouchTapping(IntouchBinarySensor):
"""Representation of an InTouch Tapping sensor."""
class IncomfortTapping(IncomfortBinarySensor):
"""Representation of an InComfort Tapping sensor."""

def __init__(self, client, boiler):
"""Initialize the binary sensor."""
super().__init__(client, boiler)

self._name = 'Tapping'
self._is_on_key = 'is_tapping'

@property
def device_state_attributes(self):
"""Return the device state attributes."""
tap_temp = self._objref.tap_temp if self.is_on else None
return {'tap_temp': tap_temp}
self._other_key = 'tap_temp'
@@ -1,4 +1,4 @@
"""Support for a Room thermostat attached to an Intouch Lan2RF gateway."""
"""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)
@@ -15,18 +15,18 @@

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

rooms = [InTouchClimate(client, r)
rooms = [InComfortClimate(client, r)
for r in heater.rooms if not r.room_temp]
if rooms:
async_add_entities(rooms)


class InTouchClimate(ClimateDevice):
"""Representation of an InTouch climate device."""
class InComfortClimate(ClimateDevice):
"""Representation of an InComfort/InTouch climate device."""

def __init__(self, client, room):
"""Initialize the climate device."""
@@ -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.6"
],
"dependencies": [],
"codeowners": [
"@zxdavb"
]
}
@@ -1,4 +1,4 @@
"""Support for the Sensors of an Intouch Lan2RF gateway."""
"""Support for an Intergas boiler via an InComfort/InTouch Lan2RF gateway."""
import logging

from homeassistant.const import (
@@ -15,18 +15,18 @@

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

async_add_entities([
IntouchSignal(client, heater),
IntouchPressure(client, heater)
IncomfortSignal(client, heater),
IncomfortPressure(client, heater)
])


class IntouchSensor(Entity):
"""Representation of an InTouch sensor."""
class IncomfortSensor(Entity):
"""Representation of an InComfort/InTouch sensor device."""

def __init__(self, client, boiler):
"""Initialize the sensor."""
@@ -67,7 +67,7 @@ def should_poll(self) -> bool:
return False


class IntouchPressure(IntouchSensor):
class IncomfortPressure(IncomfortSensor):
"""Representation of an InTouch CV Pressure sensor."""

def __init__(self, client, boiler):
@@ -90,7 +90,7 @@ def device_state_attributes(self):
return {k: self._objref.status[k] for k in keys}


class IntouchSignal(IntouchSensor):
class IncomfortSignal(IncomfortSensor):
"""Representation of an InTouch Signal strength sensor."""

def __init__(self, client, boiler):
@@ -1,4 +1,4 @@
"""Support for an Intergas boiler attached to an Intouch Lan2RF gateway."""
"""Support for an Intergas boiler via an InComfort/Intouch Lan2RF gateway."""
import asyncio
import logging

@@ -10,24 +10,24 @@

_LOGGER = logging.getLogger(__name__)

INTOUCH_SUPPORT_FLAGS = 0
INCOMFORT_SUPPORT_FLAGS = 0

INTOUCH_MAX_TEMP = 80.0
INTOUCH_MIN_TEMP = 30.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 Intouch water_heater entity."""
"""Set up an InComfort/Intouch water_heater device."""
client = hass.data[DOMAIN]['client']
heater = hass.data[DOMAIN]['heater']

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


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

def __init__(self, client, boiler):
"""Initialize the water_heater device."""
@@ -57,12 +57,12 @@ def current_temperature(self):
@property
def min_temp(self):
"""Return max valid temperature that can be set."""
return INTOUCH_MIN_TEMP
return INCOMFORT_MIN_TEMP

@property
def max_temp(self):
"""Return max valid temperature that can be set."""
return INTOUCH_MAX_TEMP
return INCOMFORT_MAX_TEMP

@property
def temperature_unit(self):
@@ -72,7 +72,7 @@ def temperature_unit(self):
@property
def supported_features(self):
"""Return the list of supported features."""
return INTOUCH_SUPPORT_FLAGS
return INCOMFORT_SUPPORT_FLAGS

@property
def state(self):
This conversation was marked as resolved by zxdavb

This comment has been minimized.

Copy link
@MartinHjelmare

MartinHjelmare May 7, 2019

Member

Don't overwrite state property. That's the responsibility of the base water_heater entity.

This comment has been minimized.

Copy link
@zxdavb

zxdavb May 7, 2019

Author Contributor

Oops, changed to:

    def current_operation(self):

This file was deleted.

@@ -595,15 +595,15 @@ iglo==1.2.7
# homeassistant.components.ihc
ihcsdk==2.3.0

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

# homeassistant.components.influxdb
influxdb==5.2.0

# homeassistant.components.insteon
insteonplm==0.15.2

# homeassistant.components.intouch
intouch-client==0.2.4

# homeassistant.components.iperf3
iperf3==0.1.10

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.