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