ndokter / dsmr_parser

Library to parse Dutch Smart Meter Requirements (DSMR) telegrams.
MIT License
110 stars 64 forks source link

HA: ValueError: invalid literal for int() with base 16: '140W' #65

Closed matthijsberg closed 8 months ago

matthijsberg commented 3 years ago

HI,

I'm using this in Home Assistant. I get quite some CRC errors (2020-12-11 21:01:13 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '45204' does not match the expected '29681') and the error below. I connect to a Landis & Gyr E360 via DSMR 5 directly connected. It looks like I get a value in the CRC field? most of the error are CRC, sometimes I get this:

2020-12-12 14:11:47 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback SerialTransport._read_ready()
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/asyncio/events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.8/site-packages/serial_asyncio/__init__.py", line 106, in _read_ready
    self._protocol.data_received(data)
  File "/usr/local/lib/python3.8/site-packages/dsmr_parser/clients/protocol.py", line 92, in data_received
    self.handle_telegram(telegram)
  File "/usr/local/lib/python3.8/site-packages/dsmr_parser/clients/protocol.py", line 107, in handle_telegram
    parsed_telegram = self.telegram_parser.parse(telegram)
  File "/usr/local/lib/python3.8/site-packages/dsmr_parser/parsers.py", line 47, in parse
    self.validate_checksum(telegram_data)
  File "/usr/local/lib/python3.8/site-packages/dsmr_parser/parsers.py", line 83, in validate_checksum
    expected_crc = int(checksum_hex.group(0), base=16)
ValueError: invalid literal for int() with base 16: '140W'

Let me know if you need more information (and some pointers where to get it) if needed.

teun95 commented 2 years ago

I also have this problem, even though the integration seems to function well otherwise.

2022-01-04 16:10:50 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '54223' does not match the expected '61526'
2022-01-04 16:10:54 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '11209' does not match the expected '55766'
2022-01-04 16:11:17 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '13439' does not match the expected '17915'
2022-01-04 16:11:45 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '44963' does not match the expected '26866'
2022-01-04 16:12:15 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '4912' does not match the expected '29616'
2022-01-04 16:12:16 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '31909' does not match the expected '33087'
2022-01-04 16:12:16 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '31909' does not match the expected '33087'
2022-01-04 16:13:04 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '64853' does not match the expected '3081'
2022-01-04 16:13:16 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '4820' does not match the expected '40797'
2022-01-04 16:15:29 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '12627' does not match the expected '16185'
2022-01-04 16:16:04 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '17665' does not match the expected '1998'
2022-01-04 16:16:21 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '38217' does not match the expected '11904'
2022-01-04 16:16:21 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '38217' does not match the expected '11904'
2022-01-04 16:16:31 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '46371' does not match the expected '34698'
2022-01-04 16:16:31 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '49176' does not match the expected '43517'
2022-01-04 16:17:29 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '52017' does not match the expected '35326'
2022-01-04 16:19:56 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '56945' does not match the expected '30838'
2022-01-04 16:20:01 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '46411' does not match the expected '54639'
2022-01-04 16:20:17 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '54984' does not match the expected '10025'
2022-01-04 16:20:29 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '22656' does not match the expected '35361'
2022-01-04 16:20:34 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '27189' does not match the expected '55116'
2022-01-04 16:20:54 WARNING (MainThread) [dsmr_parser.clients.protocol] Invalid telegram. The CRC checksum '23435' does not match the expected '49207'
ndokter commented 2 years ago

What would help if you could add raw telegram data. User lowdef explained how that could be done here: https://github.com/ndokter/dsmr_parser/issues/91#issuecomment-962428443

dupondje commented 8 months ago

Closed as no response received.