Skip to content

Commit

Permalink
Update serial stats to new format
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Nov 5, 2021
1 parent 2d3af52 commit f3ee902
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions custom_components/xiaomi_gateway3/core/gateway3.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,11 @@ async def update_serial_stats(self):
return
serial = await sh.read_file('/proc/tty/driver/serial')
lines = serial.decode().split('\n')
stats = {
s: {k: int(v) for k, v in RE_SERIAL.findall(lines[i])}
for i, s in enumerate(('bluetooth', 'zigbee'), 2)
}
stats = {}
for k, v in RE_SERIAL.findall(lines[2]):
stats[f"bluetooth_{k}"] = int(v)
for k, v in RE_SERIAL.findall(lines[3]):
stats[f"zigbee_{k}"] = int(v)
await self.process_gw_stats(stats)

finally:
Expand Down

0 comments on commit f3ee902

Please sign in to comment.