Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Suggestion] Ignore errors on encoding a known message #68

Open
snirsh opened this issue Sep 5, 2021 · 1 comment
Open

[Suggestion] Ignore errors on encoding a known message #68

snirsh opened this issue Sep 5, 2021 · 1 comment

Comments

@snirsh
Copy link

snirsh commented Sep 5, 2021

Hi, I've been testing this for some time now and I see some errors regarding a 'feed' with the error I've mentioned before:

feeder.util.mqtt.client: Failed to decode message: bytearray(b'{"_|deviceHid":"89dfa32aa126ff9964811ffffdf7e1c69c43b82a","s|msg_type":"trace","i|tl":32,"s|ts":"Start - D\xdf, Portion: 0 tbsp(309448g), Turns: 26, Bowl: 0g, Hopp"}')

This is due to ".../mqtt/client.py", line 102, handle_message, would suggest json.loads(packet.payload.data, 'ignore') which will ignore this small problem.

@snirsh
Copy link
Author

snirsh commented Sep 5, 2021

small fix:

this should probably be:

decoded_payload = packet.payload.data.decode('utf-8', 'ignore')
payload = json.loads(decoded_payload)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant