FHEM logging & new dimmer
This commit is contained in:
parent
87e199e260
commit
08a0d17fa0
|
@ -36,6 +36,11 @@ light:
|
||||||
- office_rebecca
|
- office_rebecca
|
||||||
|
|
||||||
|
|
||||||
|
- name: Steckdosen Dimmer
|
||||||
|
dimmer: True
|
||||||
|
fhem_ids:
|
||||||
|
- Steckdose_Dimmer
|
||||||
|
|
||||||
# ---------------------------------- Covers ------------------------------------
|
# ---------------------------------- Covers ------------------------------------
|
||||||
|
|
||||||
cover:
|
cover:
|
||||||
|
|
|
@ -66,6 +66,8 @@ class FhemSwitch(SwitchDevice):
|
||||||
|
|
||||||
async def line_received(self, line):
|
async def line_received(self, line):
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
|
if not self._available:
|
||||||
|
_LOGGER.warning(f"Line for unavailable device {self.name}: {line}")
|
||||||
if line.startswith('level:'):
|
if line.startswith('level:'):
|
||||||
self._available = True
|
self._available = True
|
||||||
_, new_state = line.split(':')
|
_, new_state = line.split(':')
|
||||||
|
@ -77,11 +79,13 @@ class FhemSwitch(SwitchDevice):
|
||||||
await self.async_update_ha_state()
|
await self.async_update_ha_state()
|
||||||
elif line in ('on', 'off'):
|
elif line in ('on', 'off'):
|
||||||
self._available = True
|
self._available = True
|
||||||
prev = self._on
|
|
||||||
self._on = (line == 'on')
|
self._on = (line == 'on')
|
||||||
await self.async_update_ha_state()
|
await self.async_update_ha_state()
|
||||||
elif line.startswith('ResndFail') or line.startswith('MISSING ACK'):
|
elif line.startswith('ResndFail') or line.startswith('MISSING ACK'):
|
||||||
self._available = False
|
self._available = False
|
||||||
|
_LOGGER.warning(f"FHEM device {self.name} became unavailable: {line}")
|
||||||
await self.async_update_ha_state()
|
await self.async_update_ha_state()
|
||||||
else:
|
else:
|
||||||
|
if not self._available:
|
||||||
|
_LOGGER.warning(f"Other line from unavailable FHEM device {self.name}: {line}")
|
||||||
device_error_reporting(self.hass, line, component_type="Switch", component_name=self.entity_id)
|
device_error_reporting(self.hass, line, component_type="Switch", component_name=self.entity_id)
|
||||||
|
|
|
@ -61,7 +61,6 @@ class ReconnectingClient:
|
||||||
if not line:
|
if not line:
|
||||||
raise OSError("Disconnect")
|
raise OSError("Disconnect")
|
||||||
line = line.decode()
|
line = line.decode()
|
||||||
_LOGGER.warning("{} received line: {}".format(self._connection_name, line))
|
|
||||||
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':
|
||||||
|
|
Loading…
Reference in New Issue