DSMR help needed

We recently received a smart meter here, and I would like to read the data from it.

I’ve got a spare Raspberry with a P1 connector laying around that I’m using. I’ve set it up, and it works.

When I run $ cu -l /dev/ttyAMA0 -s 115200 --parity=none I get the data every second, so I assume I’ve got a V5 reader, since V4 is every 10 seconds.

Since HASS doesn’t run on the raspberry I thought I would use ser2net to make it available for HASS. I’ve installed and configured it in the /etc/ser2net.conf file with this line added:
2001:raw:600:/dev/ttyAMA0:115200 NONE 1STOPBIT 8DATABITS XONXOFF LOCAL -RTSCTS
And all other lines commented out obviously.

Then in my HASS configuration I’ve added this:

sensor:

  • platform: dsmr
    host: 192.168.178.248
    port: 2001
    dsmr_version: 5

All according to the docs, right? I’ve tried V2, V4, V5, but same error keeps popping up. I must miss something simple but crucial…

Error:
2019-02-26 21:01:22 ERROR (MainThread) [homeassistant.core] Error doing job: Fatal error on transport TCPTransport Traceback (most recent call last): File "uvloop/handles/stream.pyx", line 827, in uvloop.loop.__uv_stream_on_read_impl File "/usr/local/lib/python3.7/site-packages/dsmr_parser/clients/protocol.py", line 83, in data_received data = data.decode('ascii') UnicodeDecodeError: 'ascii' codec can't decode byte 0xcc in position 5: ordinal not in range(128) 2019-02-26 21:01:22 ERROR (MainThread) [dsmr_parser.clients.protocol] disconnected due to exception NoneType: None 2019-02-26 21:01:22 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback UVTransport._call_connection_lost Traceback (most recent call last): File "uvloop/cbhandles.pyx", line 70, in uvloop.loop.Handle._run File "uvloop/handles/basetransport.pyx", line 181, in uvloop.loop.UVBaseTransport._call_connection_lost File "/usr/local/lib/python3.7/site-packages/dsmr_parser/clients/protocol.py", line 93, in connection_lost self.log.exception('disconnected due to exception') File "/usr/local/lib/python3.7/logging/__init__.py", line 1418, in exception self.error(msg, *args, exc_info=exc_info, **kwargs) File "/usr/local/lib/python3.7/logging/__init__.py", line 1412, in error self._log(ERROR, msg, args, **kwargs) File "/usr/local/lib/python3.7/logging/__init__.py", line 1519, in _log self.handle(record) File "/usr/local/lib/python3.7/logging/__init__.py", line 1529, in handle self.callHandlers(record) File "/usr/local/lib/python3.7/logging/__init__.py", line 1591, in callHandlers hdlr.handle(record) File "/usr/local/lib/python3.7/logging/__init__.py", line 905, in handle self.emit(record) File "/usr/src/app/homeassistant/components/system_log/__init__.py", line 168, in emit _figure_out_source(record, stack, self.hass)) File "/usr/src/app/homeassistant/components/system_log/__init__.py", line 99, in __init__ self.root_cause = str(traceback.extract_tb(tb)[-1]) IndexError: list index out of range

My meter is a Landis+Gyr E360 by the way. And it’s Indeed DSMR 5.0.

Edit: just found this: https://github.com/ndokter/dsmr_parser/issues/35
Would be great if this was pushed to HASS as well.

Bump, just tried the fix I mentioned, but no data is appearing. I no longer get the error though.

On request.
First line from my ser2net.conf
3334:telnet:0:/dev/ttyUSB-P1:9600 7DATABITS EVEN 1STOPBIT max-connections=2 tr=tr1 timestamp

and my configuration.yaml
sensor:

  • platform: dsmr
    host: 192.168.1.135
    port: 3334
    dsmr_version: 2.2

group:
meter_readings:
name: Meter readings
entities:
- sensor.power_consumption_low
- sensor.power_consumption_normal
- sensor.power_production_low
- sensor.power_production_normal
- sensor.gas_consumption

Cheers.

When you use putty (or whatever) to login to the telnet at the right address, what do you see? I mostly get this:

Tried both raw and telnet, but same result. Only difference in my config is that I use DSMR 5.

How come you use telnet? When I try that I get this:

2019-03-01 18:46:37 ERROR (MainThread) [dsmr_parser.clients.protocol] failed to parse telegram Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/dsmr_parser/clients/protocol.py", line 103, in handle_telegram parsed_telegram = self.telegram_parser.parse(telegram) File "/usr/local/lib/python3.7/site-packages/dsmr_parser/parsers.py", line 47, in parse self.validate_checksum(telegram_data) File "/usr/local/lib/python3.7/site-packages/dsmr_parser/parsers.py", line 78, in validate_checksum 'Failed to perform CRC validation because the telegram is ' dsmr_parser.exceptions.ParseError: Failed to perform CRC validation because the telegram is incomplete. The checksum and/or content values are missing. 2019-03-01 18:50:42 WARNING (MainThread) [hbmqtt.mqtt.protocol.handler] BrokerProtocolHandler Unhandled exception in reader coro: IncompleteReadError('0 bytes read on a total of 1 expected bytes')

When I use cu to watch the data I get this, which seems normal, right?

Having the same issue. Watching this topic.
I’m getting the following error in hassio:

Log Details (ERROR)
Thu Mar 28 2019 01:30:01 GMT+0100 (Central European Standard Time)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
    File "/usr/local/lib/python3.7/site-packages/homeassistant/components/sensor/dsmr.py", line 206, in 
connect_and_reconnect
    reader_factory())
File "uvloop/loop.pyx", line 1821, in create_connection
socket.gaierror: [Errno -8] Unrecognized service

looking forward to a solution :pray:

Edit: I’m sorry, my error is not the same as topic starter, but @Gerben321’s is the same.

I have also this issue, my logs how:

2019-08-27 21:50:17 ERROR (MainThread) [dsmr_parser.clients.protocol] failed to parse telegram
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/dsmr_parser/clients/protocol.py", line 103, in handle_telegram
    parsed_telegram = self.telegram_parser.parse(telegram)
  File "/usr/local/lib/python3.7/site-packages/dsmr_parser/parsers.py", line 47, in parse
    self.validate_checksum(telegram_data)
  File "/usr/local/lib/python3.7/site-packages/dsmr_parser/parsers.py", line 78, in validate_checksum
    'Failed to perform CRC validation because the telegram is '
dsmr_parser.exceptions.ParseError: Failed to perform CRC validation because the telegram is incomplete. The checksum and/or content values are missing.

In HA I see all meter readings. So it seems to me that it is an empty line at the end of a telemetry message?

Happens on meter Landys+Gyr E360 with a direct usb/serial connection. Protocol is DSMR 5.

is there already a solution for this problem?

My solution was to buy a different adapter. Worked directly and flawlessly after that!

Een andere adapter? Welke kabel moet ik dan hebben? Heb nu een kabel voor p1 naar usb en deze werkt goed op domoticz…

@Gerben321 Hi,
I just switched from a Landis Gyr E350 to a Landis Gyr E360.
It worked fine with the E350, but as you did, I have lots of errors now with the E360.

Could you share what P1 meter you bought to get it working?
The connector in the meter itself is a 6pin one.
The connector on my usb cable currently is 4pin one.

Thanks in advance

For information sharing purpose, these are the error messages I get:

Logger: dsmr_parser.clients.protocol
Source: /usr/local/lib/python3.8/site-packages/dsmr_parser/clients/protocol.py:113
First occurred: 9:20:15 AM (19 occurrences)
Last logged: 9:20:44 AM

Invalid telegram. The CRC checksum '17491' does not match the expected '3663'
Invalid telegram. The CRC checksum '7647' does not match the expected '48358'
Invalid telegram. The CRC checksum '30220' does not match the expected '40094'
Invalid telegram. The CRC checksum '48633' does not match the expected '26388'
Invalid telegram. The CRC checksum '6048' does not match the expected '61850'
Logger: homeassistant
Source: /usr/src/homeassistant/homeassistant/runner.py:93
First occurred: 9:20:15 AM (117 occurrences)
Last logged: 9:20:44 AM

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 119, in _read_ready
    self._protocol.data_received(data)
  File "/usr/local/lib/python3.8/site-packages/dsmr_parser/clients/protocol.py", line 91, in data_received
    data = data.decode('ascii')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xa8 in position 38: ordinal not in range(128)
Logger: dsmr_parser.clients.protocol
Source: /usr/local/lib/python3.8/site-packages/dsmr_parser/clients/protocol.py:115
First occurred: 9:20:27 AM (2 occurrences)
Last logged: 9:20:40 AM

failed to parse telegram
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/dsmr_parser/clients/protocol.py", line 111, in handle_telegram
    parsed_telegram = self.telegram_parser.parse(telegram)
  File "/usr/local/lib/python3.8/site-packages/dsmr_parser/parsers.py", line 49, in parse
    self.validate_checksum(telegram_data)
  File "/usr/local/lib/python3.8/site-packages/dsmr_parser/parsers.py", line 79, in validate_checksum
    raise ParseError(
dsmr_parser.exceptions.ParseError: Failed to perform CRC validation because the telegram is incomplete. The checksum and/or content values are missing.

What happend? Why is every thread a dead end in Home assistant community!

hi,
what do you mean with dead?

just to give feedback on this issue.
the meter itself was at fault. I had it swopped. Now its working perfeclty.

update:
I already posted this information in another thread. you might have missed this… see: