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

[BUG] ValueError in zc_decode #49

Closed
jimboca opened this issue Apr 6, 2022 · 2 comments
Closed

[BUG] ValueError in zc_decode #49

jimboca opened this issue Apr 6, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@jimboca
Copy link
Contributor

jimboca commented Apr 6, 2022

Describe the bug

I've been running with this library for a long time and first time I noticed this error, very strange character imbedded in this message.

2022-04-05 16:42:10,041 ELK-13367  elkm1_lib.elk      ERROR    elk:_got_data: Invalid message '0AZC2¼220040'
Traceback (most recent call last):
  File "/var/polyglot/.local/lib/python3.8/site-packages/elkm1_lib/message.py", line 67, in decode
    self.call_handlers(cmd, decoder(msg))
  File "/var/polyglot/.local/lib/python3.8/site-packages/elkm1_lib/message.py", line 290, in _zc_decode
    return {"zone_number": int(msg[4:7]) - 1, "zone_status": status}
ValueError: invalid literal for int() with base 10: '2¼2'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/var/polyglot/.local/lib/python3.8/site-packages/elkm1_lib/elk.py", line 139, in _got_data
    self._message_decode.decode(data)
  File "/var/polyglot/.local/lib/python3.8/site-packages/elkm1_lib/message.py", line 69, in decode
    raise ValueError("Cannot decode message") from exc
ValueError: Cannot decode message

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions (please complete the following information):

  • ElkM1 version: [1.0.0]
  • Home Assistant version: [N/A]

Additional context
Add any other context about the problem here.

@jimboca jimboca added the bug Something isn't working label Apr 6, 2022
@gwww
Copy link
Owner

gwww commented Apr 6, 2022

Well that is interesting! Does it happen all the time? Do you have a guess as to what zone you think it is?

I did a couple of quick checks. ¼ is hex BC or decimal 188. The checksum and length on the message are correct, which means that the Elk panel sent this bad message -- I don't see how the lib could have messed up the message. What version of the Elk software on you running on the panel? This is a Elk panel bug, so fix will have to come from them.

The lib could be smarter with guards on decoding. Something I will consider, but it won't help you either way.

@gwww
Copy link
Owner

gwww commented Apr 6, 2022

I just took another look at the code. Looks like there are enough guards already there - I catch the ValueError and print the message of "Cannot decode...". So nothing for me to do with the lib as far as I can tell.

If you figure it out, I'd love to hear the cause of this from the panel.

@gwww gwww closed this as completed Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants