More tolerant KNX component if gateway cant be connected (#11511)
* Issue #11432: Do not stop initializing KNX when tunelling device cant be reached * Issue #11432: Mark devices as unavailable if gateway cant be connectedpull/10192/merge
parent
c20324793e
commit
efb83dde19
|
@ -129,6 +129,11 @@ class KNXBinarySensor(BinarySensorDevice):
|
||||||
"""Return the name of the KNX device."""
|
"""Return the name of the KNX device."""
|
||||||
return self.device.name
|
return self.device.name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def available(self):
|
||||||
|
"""Return True if entity is available."""
|
||||||
|
return self.hass.data[DATA_KNX].connected
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
"""No polling needed within KNX."""
|
"""No polling needed within KNX."""
|
||||||
|
|
|
@ -159,6 +159,11 @@ class KNXClimate(ClimateDevice):
|
||||||
"""Return the name of the KNX device."""
|
"""Return the name of the KNX device."""
|
||||||
return self.device.name
|
return self.device.name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def available(self):
|
||||||
|
"""Return True if entity is available."""
|
||||||
|
return self.hass.data[DATA_KNX].connected
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
"""No polling needed within KNX."""
|
"""No polling needed within KNX."""
|
||||||
|
|
|
@ -124,6 +124,11 @@ class KNXCover(CoverDevice):
|
||||||
"""Return the name of the KNX device."""
|
"""Return the name of the KNX device."""
|
||||||
return self.device.name
|
return self.device.name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def available(self):
|
||||||
|
"""Return True if entity is available."""
|
||||||
|
return self.hass.data[DATA_KNX].connected
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
"""No polling needed within KNX."""
|
"""No polling needed within KNX."""
|
||||||
|
|
|
@ -80,8 +80,11 @@ def async_setup(hass, config):
|
||||||
yield from hass.data[DATA_KNX].start()
|
yield from hass.data[DATA_KNX].start()
|
||||||
|
|
||||||
except XKNXException as ex:
|
except XKNXException as ex:
|
||||||
_LOGGER.exception("Can't connect to KNX interface: %s", ex)
|
_LOGGER.warning("Can't connect to KNX interface: %s", ex)
|
||||||
return False
|
hass.components.persistent_notification.async_create(
|
||||||
|
"Can't connect to KNX interface: <br>"
|
||||||
|
"<b>{0}</b>".format(ex),
|
||||||
|
title="KNX")
|
||||||
|
|
||||||
for component, discovery_type in (
|
for component, discovery_type in (
|
||||||
('switch', 'Switch'),
|
('switch', 'Switch'),
|
||||||
|
@ -120,7 +123,8 @@ class KNXModule(object):
|
||||||
"""Initialization of KNXModule."""
|
"""Initialization of KNXModule."""
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
self.config = config
|
self.config = config
|
||||||
self.initialized = False
|
self.connected = False
|
||||||
|
self.initialized = True
|
||||||
self.init_xknx()
|
self.init_xknx()
|
||||||
self.register_callbacks()
|
self.register_callbacks()
|
||||||
|
|
||||||
|
@ -139,7 +143,7 @@ class KNXModule(object):
|
||||||
state_updater=self.config[DOMAIN][CONF_KNX_STATE_UPDATER],
|
state_updater=self.config[DOMAIN][CONF_KNX_STATE_UPDATER],
|
||||||
connection_config=connection_config)
|
connection_config=connection_config)
|
||||||
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self.stop)
|
self.hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, self.stop)
|
||||||
self.initialized = True
|
self.connected = True
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def stop(self, event):
|
def stop(self, event):
|
||||||
|
|
|
@ -97,6 +97,11 @@ class KNXLight(Light):
|
||||||
"""Return the name of the KNX device."""
|
"""Return the name of the KNX device."""
|
||||||
return self.device.name
|
return self.device.name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def available(self):
|
||||||
|
"""Return True if entity is available."""
|
||||||
|
return self.hass.data[DATA_KNX].connected
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
"""No polling needed within KNX."""
|
"""No polling needed within KNX."""
|
||||||
|
|
|
@ -90,6 +90,11 @@ class KNXSensor(Entity):
|
||||||
"""Return the name of the KNX device."""
|
"""Return the name of the KNX device."""
|
||||||
return self.device.name
|
return self.device.name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def available(self):
|
||||||
|
"""Return True if entity is available."""
|
||||||
|
return self.hass.data[DATA_KNX].connected
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
"""No polling needed within KNX."""
|
"""No polling needed within KNX."""
|
||||||
|
|
|
@ -89,6 +89,11 @@ class KNXSwitch(SwitchDevice):
|
||||||
"""Return the name of the KNX device."""
|
"""Return the name of the KNX device."""
|
||||||
return self.device.name
|
return self.device.name
|
||||||
|
|
||||||
|
@property
|
||||||
|
def available(self):
|
||||||
|
"""Return True if entity is available."""
|
||||||
|
return self.hass.data[DATA_KNX].connected
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def should_poll(self):
|
def should_poll(self):
|
||||||
"""No polling needed within KNX."""
|
"""No polling needed within KNX."""
|
||||||
|
|
Loading…
Reference in New Issue