FHEM & reconnecting client fixes

This commit is contained in:
Martin Bauer
2019-07-07 17:30:45 +02:00
parent 06f96cb2dc
commit e6f5504181
8 changed files with 34 additions and 13 deletions

View File

@@ -60,6 +60,9 @@ class FhemSensor(Entity):
def state(self):
return self._state
def refresh(self):
pass
async def line_received(self, line):
if self._type == 'brightness' and line.startswith('brightness'):
self._available = True
@@ -69,7 +72,7 @@ class FhemSensor(Entity):
elif self._type == 'power' and line.startswith('power'):
self._available = True
_, new_value = line.split(':')
self._state = int(new_value)
self._state = float(new_value)
await self.async_update_ha_state()
elif line.startswith('ResndFail') or line.startswith('MISSING ACK'):
self._available = False