Logger integration & more log messages

This commit is contained in:
Martin Bauer 2019-12-02 20:18:14 +01:00
parent 4722abce31
commit 0391f03244
3 changed files with 8 additions and 3 deletions

View File

@ -94,8 +94,8 @@ dimmer:
cover_half: cover_half:
#logger: logger:
# default: info default: info
# logs: # logs:
# xknx.telegram: debug # xknx.telegram: debug
# xknx.knx: debug # xknx.knx: debug

View File

@ -66,6 +66,7 @@ class FhemSwitch(SwitchDevice):
async def line_received(self, line): async def line_received(self, line):
line = line.strip() line = line.strip()
_LOGGER.debug(f"Switch received line {line}")
if not self._available: if not self._available:
_LOGGER.warning(f"Line for unavailable device {self.name}: {line}") _LOGGER.warning(f"Line for unavailable device {self.name}: {line}")
if line.startswith('level:'): if line.startswith('level:'):

View File

@ -64,10 +64,14 @@ class ReconnectingClient:
await self._receive_line_callback(line) await self._receive_line_callback(line)
except OSError as e: except OSError as e:
if self._connection_last_state != 'FAILED': if self._connection_last_state != 'FAILED':
notification_text = "{} connection to {}:{} failed".format(self._connection_name,self._host, self._port) notification_text = "{} connection to {}:{} failed".format(self._connection_name, self._host,
self._port)
self.hass.components.persistent_notification.async_create(notification_text, title="No connection") self.hass.components.persistent_notification.async_create(notification_text, title="No connection")
_LOGGER.error("Connection to {} failed {}:{}".format(self._connection_name, self._host, self._port)) _LOGGER.error("Connection to {} failed {}:{}".format(self._connection_name, self._host, self._port))
await self._connection_status_changed_callback('disconnected') await self._connection_status_changed_callback('disconnected')
else:
_LOGGER.debug(f"{self._connection_name} retried connection, last state {self._connection_last_state}"
f"reconnection time {self.reconnect_time}")
self._connection_last_state = 'FAILED' self._connection_last_state = 'FAILED'
self.connected = False self.connected = False
await asyncio.sleep(self.reconnect_time) await asyncio.sleep(self.reconnect_time)