Skip to content

Commit

Permalink
Fix two json in miio logs bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Nov 3, 2020
1 parent 3420fa9 commit a19ea6e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions custom_components/xiaomi_gateway3/core/gateway3.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ def process_zb_message(self, payload: dict):
def process_ble_event(self, raw: Union[bytes, str]):
try:
if isinstance(raw, bytes):
# fix two json bug
if '}{' in raw:
raw = raw[:raw.index('}{') + 1]
m = RE_JSON.search(raw)
data = json.loads(m[0])['params']
else:
Expand Down Expand Up @@ -603,6 +606,9 @@ def process_ble_retain(self, did: str, payload: dict):
def process_mesh_data(self, raw: Union[bytes, list]):
try:
if isinstance(raw, bytes):
# fix two json bug
if '}{' in raw:
raw = raw[:raw.index('}{') + 1]
m = RE_JSON.search(raw)
data = json.loads(m[0])['params']
else:
Expand Down

0 comments on commit a19ea6e

Please sign in to comment.