spacemanspiff2007/SmlLib

Trying to get it running; getting AttributeError

Closed this issue · 22 comments

Hello,

I'm trying to get your SmlLib running on my Raspberry Pi with Python 3.9 and a DZG DWZ7412.2 smart meter. When parsing an incoming SML message I'm getting the following error:

Traceback (most recent call last):
  File "/home/pi/.asdf/installs/python/3.9.2/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/serial_asyncio/__init__.py", line 119, in _read_ready
    self._protocol.data_received(data)
  File "/home/pi/my_sml2mqtt/main.py", line 59, in data_received
    self.parser.parse(data)
  File "/home/pi/my_sml2mqtt/main.py", line 32, in parse
    parsed_msgs = sml_frame.parse_frame()
  File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/smllib/sml_frame.py", line 93, in parse_frame
    ret.append(SmlMessage.from_list(val))
  File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/smllib/sml_fields.py", line 102, in from_list
    _in[3] = get_msg_cls(_in[3])
  File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/smllib/sml_fields.py", line 241, in get_msg_cls
    return cls.from_list(_in[1])
  File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/smllib/sml_fields.py", line 47, in from_list

I'm not sure if there is personal data in the SML message. Can I send it to you too without having to worry about that?

Thanks! Seems like your lib is the only available for Python. I hope I can make it run.

Does a run without the -a arg work?

Personal information is

  • The device serial number after obis 0100000009ff. You use this number to report your energy usage to supplier, so it should be really easy to find. Replace all digits with a Number (e.g. 11111...)
  • The Public Key. It's after obis 8181c78205ff and also printed on your smart meter. I'm not sure about this one but redacting can't hurt. Replace all digits with a Number (e.g. 11111...)

Running sml2mqtt without the -a argument doesn't work either. The error message is different though. Aside from that, I'm trying to use smllib in one of my own programs. I guess that shouldn't matter anyway, just to mention it.

[2021-08-23 05:20:51,535] [sml.device.ttyUSB0     ] INFO     | PORT_OPENED
[2021-08-23 05:20:52,908] [sml.device.ttyUSB0     ] ERROR    | Traceback (most recent call last):
[2021-08-23 05:20:52,911] [sml.device.ttyUSB0     ] ERROR    |   File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/sml2mqtt/sml_device.py", line 93, in read
[2021-08-23 05:20:52,913] [sml.device.ttyUSB0     ] ERROR    |     value = sml_obj.get_value()
[2021-08-23 05:20:52,915] [sml.device.ttyUSB0     ] ERROR    |   File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/smllib/sml_fields.py", line 198, in get_value
[2021-08-23 05:20:52,918] [sml.device.ttyUSB0     ] ERROR    |     return round(self.value * 10**self.scaler, abs(self.scaler) + 3)
[2021-08-23 05:20:52,920] [sml.device.ttyUSB0     ] ERROR    | TypeError: type str doesn't define __round__ method
[2021-08-23 05:20:52,923] [sml.device.ttyUSB0     ] INFO     | ERROR
[2021-08-23 05:20:52,932] [sml.serial             ] INFO     | Port /dev/ttyUSB0 was closed
[2021-08-23 05:20:52,935] [sml.device.ttyUSB0     ] INFO     | PORT_CLOSED
[2021-08-23 05:20:54,571] [concurrent.futures     ] ERROR    | exception calling callback for <Future at 0xb5b56c40 state=finished raised OSError>
Traceback (most recent call last):
  File "/home/pi/.asdf/installs/python/3.9.2/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/paho/mqtt/client.py", line 941, in connect
    return self.reconnect()
  File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/paho/mqtt/client.py", line 1075, in reconnect
    sock = self._create_socket_connection()
  File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/paho/mqtt/client.py", line 3546, in _create_socket_connection
    return socket.create_connection(addr, source_address=source, timeout=self._keepalive)
  File "/home/pi/.asdf/installs/python/3.9.2/lib/python3.9/socket.py", line 843, in create_connection
    raise err
  File "/home/pi/.asdf/installs/python/3.9.2/lib/python3.9/socket.py", line 831, in create_connection
    sock.connect(sa)
OSError: [Errno 113] No route to host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.asdf/installs/python/3.9.2/lib/python3.9/concurrent/futures/_base.py", line 329, in _invoke_callbacks
    callback(self)
  File "/home/pi/.asdf/installs/python/3.9.2/lib/python3.9/asyncio/futures.py", line 398, in _call_set_state
    dest_loop.call_soon_threadsafe(_set_state, destination, source)
  File "/home/pi/.asdf/installs/python/3.9.2/lib/python3.9/asyncio/base_events.py", line 791, in call_soon_threadsafe
    self._check_closed()
  File "/home/pi/.asdf/installs/python/3.9.2/lib/python3.9/asyncio/base_events.py", line 510, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
[2021-08-23 05:20:54,725] [asyncio                ] ERROR    | Task was destroyed but it is pending!
task: <Task pending name='Task-19' coro=<stop_loop() done, defined at /home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/sml2mqtt/_signals.py:10> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0xb52c66b8>()]>>

I'll see if I can anonymize the data and upload it here too.

Wait a sec, I've just noticed the "No route to host" message... I'll have to investigate that too... in the meantime... might they be related? I mean the TypeError and the OSError?

Okay, I've fixed the No route to host error. The other error remains the same. They are not related.

[2021-08-23 05:25:01,115] [sml.device.ttyUSB0     ] INFO     | PORT_OPENED
[2021-08-23 05:25:02,148] [sml.device.ttyUSB0     ] ERROR    | Traceback (most recent call last):
[2021-08-23 05:25:02,150] [sml.device.ttyUSB0     ] ERROR    |   File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/sml2mqtt/sml_device.py", line 93, in read
[2021-08-23 05:25:02,153] [sml.device.ttyUSB0     ] ERROR    |     value = sml_obj.get_value()
[2021-08-23 05:25:02,155] [sml.device.ttyUSB0     ] ERROR    |   File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/smllib/sml_fields.py", line 198, in get_value
[2021-08-23 05:25:02,157] [sml.device.ttyUSB0     ] ERROR    |     return round(self.value * 10**self.scaler, abs(self.scaler) + 3)
[2021-08-23 05:25:02,160] [sml.device.ttyUSB0     ] ERROR    | TypeError: type str doesn't define __round__ method
[2021-08-23 05:25:02,162] [sml.device.ttyUSB0     ] INFO     | ERROR
[2021-08-23 05:25:02,176] [sml.serial             ] INFO     | Port /dev/ttyUSB0 was closed
[2021-08-23 05:25:02,179] [sml.device.ttyUSB0     ] INFO     | PORT_CLOSED
[2021-08-23 05:25:02,350] [asyncio                ] ERROR    | Task was destroyed but it is pending!
task: <Task pending name='Task-17' coro=<stop_loop() done, defined at /home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/sml2mqtt/_signals.py:10> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0xb5c23e38>()]>>

Here are all OBIS that I'm getting from my smart meter. The ones you mentioned are not among them:

  • 010060320101
  • 0100600100ff
  • 0100010800ff
  • 0100020800ff

Can you provide the complete frame so I can reproduce the issue?

I think so. If there's no other personal information in it... the frame is rather short and the OBIS you mentioned aren't there, so I just hope there isn't any more... So here it is:

b'\x1b\x1b\x1b\x1b\x01\x01\x01\x01v\x05\x1cAL\x02b\x00b\x00rc\x01\x01v\x01\x01\x021\x0b\n\x01DZG\x00\x02\x82\xc0\xb0rb\x01e\x05G\x1c*b\x02c\xf98\x00v\x05\x1dAL\x02b\x00b\x00rc\x07\x01w\x01\x0b\n\x01DZG\x00\x02\x82\xc0\xb0\x07\x01\x00b\n\xff\xffrb\x01e\x05G\x1c*tw\x07\x01\x00`2\x01\x01\x01rb\x01b\x00b\x00R\x00\x04DZG\x01w\x07\x01\x00`\x01\x00\xff\x01rb\x01b\x00b\x00R\x00\x0b\n\x01DZG\x00\x02\x82\xc0\xb0\x01w\x07\x01\x00\x01\x08\x00\xffd\x1c\x01\x04rb\x01b\x00b\x1eR\x03c4O\x01w\x07\x01\x00\x02\x08\x00\xff\x01rb\x01b\x00b\x1eR\x03b\x00\x01\x01\x01c\x93w\x00v\x05\x1eAL\x02b\x00b\x00rc\x02\x01q\x01c\xe6\xba\x00\x00\x00\x00\x00\x1b\x1b\x1b\x1b\x1a\x04\xda\xd0'

I suppose my smart meter is not configured for detailed information yet. I'd have to enter the PIN that I don't have (yet). I'm only a tenant in the house. If I need it, I'll have to ask my landlord for the PIN.

I updated to sml2mqtt to 0.4 which includes the fix from the smllib.
Additionally I added a frame dump with the analyze option.
Could you please check if this fixes your problem and if the analyze flag properly dumps the received frame?
Thanks.

Sure, I'll go check it out. I'm currently at work though. I hope, I'll get back to it this afternoon.

I've just tried it out and it works. The frame is properly dumped with -a.

However, now I'm seeing the following error message in the log file when I run sml2mqtt without -a:

[2021-08-23 16:29:00,115] [sml2mqtt             ] ERROR    | [Errno 2] could not open port COM1: [Errno 2] No such file or directory: 'COM1'
[2021-08-23 16:29:12,969] [sml.device.ttyUSB0     ] INFO     | PORT_OPENED
[2021-08-23 16:29:14,134] [sml.device.ttyUSB0     ] INFO     | 
[2021-08-23 16:29:14,141] [sml.device.ttyUSB0     ] INFO     | Received Frame
[2021-08-23 16:29:14,153] [sml.device.ttyUSB0     ] INFO     |  -> b'760526ff4d02620062007263010176010102310b0a01445a47000282c0b0726201650547b2cf620263912500760527ff4d02620062007263070177010b0a01445a47000282c0b0070100620affff726201650547b2cf7477070100603201010172620162006200520004445a470177070100600100ff017262016200620052000b0a01445a47000282c0b00177070100010800ff641c01047262016200621e52036334540177070100020800ff017262016200621e52036200010101638f6500760528ff4d026200620072630201710163e25b00'
[2021-08-23 16:29:14,162] [sml.device.ttyUSB0     ] INFO     | 
[2021-08-23 16:29:14,191] [sml.device.ttyUSB0     ] INFO     | SmlMessage
[2021-08-23 16:29:14,199] [sml.device.ttyUSB0     ] INFO     |     transaction_id: 26ff4d02
[2021-08-23 16:29:14,208] [sml.device.ttyUSB0     ] INFO     |     group_no      : 0
[2021-08-23 16:29:14,218] [sml.device.ttyUSB0     ] INFO     |     abort_on_error: 0
[2021-08-23 16:29:14,227] [sml.device.ttyUSB0     ] INFO     |     message_body <SmlOpenResponse>
[2021-08-23 16:29:14,235] [sml.device.ttyUSB0     ] INFO     |         codepage   : None
[2021-08-23 16:29:14,242] [sml.device.ttyUSB0     ] INFO     |         client_id  : None
[2021-08-23 16:29:14,249] [sml.device.ttyUSB0     ] INFO     |         req_file_id: 31
[2021-08-23 16:29:14,256] [sml.device.ttyUSB0     ] INFO     |         server_id  : 0a01445a47000282c0b0
[2021-08-23 16:29:14,263] [sml.device.ttyUSB0     ] INFO     |         ref_time   : 88584911
[2021-08-23 16:29:14,269] [sml.device.ttyUSB0     ] INFO     |         sml_version: 2
[2021-08-23 16:29:14,276] [sml.device.ttyUSB0     ] INFO     |     crc16         : 37157
[2021-08-23 16:29:14,286] [sml.device.ttyUSB0     ] INFO     | SmlMessage
[2021-08-23 16:29:14,293] [sml.device.ttyUSB0     ] INFO     |     transaction_id: 27ff4d02
[2021-08-23 16:29:14,299] [sml.device.ttyUSB0     ] INFO     |     group_no      : 0
[2021-08-23 16:29:14,305] [sml.device.ttyUSB0     ] INFO     |     abort_on_error: 0
[2021-08-23 16:29:14,312] [sml.device.ttyUSB0     ] INFO     |     message_body <SmlGetListResponse>
[2021-08-23 16:29:14,319] [sml.device.ttyUSB0     ] INFO     |         client_id       : None
[2021-08-23 16:29:14,326] [sml.device.ttyUSB0     ] INFO     |         sever_id        : 0a01445a47000282c0b0
[2021-08-23 16:29:14,332] [sml.device.ttyUSB0     ] INFO     |         list_name       : 0100620affff
[2021-08-23 16:29:14,339] [sml.device.ttyUSB0     ] INFO     |         act_sensor_time : 88584911
[2021-08-23 16:29:14,346] [sml.device.ttyUSB0     ] INFO     |         val_list: list
[2021-08-23 16:29:14,353] [sml.device.ttyUSB0     ] INFO     |             <SmlListEntry>
[2021-08-23 16:29:14,360] [sml.device.ttyUSB0     ] INFO     |                 obis           : 010060320101
[2021-08-23 16:29:14,366] [sml.device.ttyUSB0     ] INFO     |                 status         : None
[2021-08-23 16:29:14,373] [sml.device.ttyUSB0     ] INFO     |                 val_time       : [1, 0]
[2021-08-23 16:29:14,380] [sml.device.ttyUSB0     ] INFO     |                 unit           : 0
[2021-08-23 16:29:14,387] [sml.device.ttyUSB0     ] INFO     |                 scaler         : 0
[2021-08-23 16:29:14,394] [sml.device.ttyUSB0     ] INFO     |                 value          : DZG
[2021-08-23 16:29:14,400] [sml.device.ttyUSB0     ] INFO     |                 value_signature: None
[2021-08-23 16:29:14,407] [sml.device.ttyUSB0     ] INFO     |             <SmlListEntry>
[2021-08-23 16:29:14,415] [sml.device.ttyUSB0     ] INFO     |                 obis           : 0100600100ff
[2021-08-23 16:29:14,421] [sml.device.ttyUSB0     ] INFO     |                 status         : None
[2021-08-23 16:29:14,428] [sml.device.ttyUSB0     ] INFO     |                 val_time       : [1, 0]
[2021-08-23 16:29:14,435] [sml.device.ttyUSB0     ] INFO     |                 unit           : 0
[2021-08-23 16:29:14,442] [sml.device.ttyUSB0     ] INFO     |                 scaler         : 0
[2021-08-23 16:29:14,449] [sml.device.ttyUSB0     ] INFO     |                 value          : 0a01445a47000282c0b0
[2021-08-23 16:29:14,456] [sml.device.ttyUSB0     ] INFO     |                 value_signature: None
[2021-08-23 16:29:14,462] [sml.device.ttyUSB0     ] INFO     |             <SmlListEntry>
[2021-08-23 16:29:14,469] [sml.device.ttyUSB0     ] INFO     |                 obis           : 0100010800ff
[2021-08-23 16:29:14,476] [sml.device.ttyUSB0     ] INFO     |                 status         : 1835268
[2021-08-23 16:29:14,483] [sml.device.ttyUSB0     ] INFO     |                 val_time       : [1, 0]
[2021-08-23 16:29:14,489] [sml.device.ttyUSB0     ] INFO     |                 unit           : 30
[2021-08-23 16:29:14,496] [sml.device.ttyUSB0     ] INFO     |                 scaler         : 3
[2021-08-23 16:29:14,503] [sml.device.ttyUSB0     ] INFO     |                 value          : 13396
[2021-08-23 16:29:14,510] [sml.device.ttyUSB0     ] INFO     |                 value_signature: None
[2021-08-23 16:29:14,517] [sml.device.ttyUSB0     ] INFO     |                 -> 13396000Wh (Zählerstand Total)
[2021-08-23 16:29:14,523] [sml.device.ttyUSB0     ] INFO     |             <SmlListEntry>
[2021-08-23 16:29:14,530] [sml.device.ttyUSB0     ] INFO     |                 obis           : 0100020800ff
[2021-08-23 16:29:14,537] [sml.device.ttyUSB0     ] INFO     |                 status         : None
[2021-08-23 16:29:14,544] [sml.device.ttyUSB0     ] INFO     |                 val_time       : [1, 0]
[2021-08-23 16:29:14,551] [sml.device.ttyUSB0     ] INFO     |                 unit           : 30
[2021-08-23 16:29:14,557] [sml.device.ttyUSB0     ] INFO     |                 scaler         : 3
[2021-08-23 16:29:14,564] [sml.device.ttyUSB0     ] INFO     |                 value          : 0
[2021-08-23 16:29:14,571] [sml.device.ttyUSB0     ] INFO     |                 value_signature: None
[2021-08-23 16:29:14,578] [sml.device.ttyUSB0     ] INFO     |                 -> 0Wh
[2021-08-23 16:29:14,585] [sml.device.ttyUSB0     ] INFO     |         list_signature  : None
[2021-08-23 16:29:14,591] [sml.device.ttyUSB0     ] INFO     |         act_gateway_time: None
[2021-08-23 16:29:14,598] [sml.device.ttyUSB0     ] INFO     |     crc16         : 36709
[2021-08-23 16:29:14,606] [sml.device.ttyUSB0     ] INFO     | SmlMessage
[2021-08-23 16:29:14,612] [sml.device.ttyUSB0     ] INFO     |     transaction_id: 28ff4d02
[2021-08-23 16:29:14,619] [sml.device.ttyUSB0     ] INFO     |     group_no      : 0
[2021-08-23 16:29:14,626] [sml.device.ttyUSB0     ] INFO     |     abort_on_error: 0
[2021-08-23 16:29:14,633] [sml.device.ttyUSB0     ] INFO     |     message_body <SmlCloseResponse>
[2021-08-23 16:29:14,639] [sml.device.ttyUSB0     ] INFO     |         global_signature: None
[2021-08-23 16:29:14,646] [sml.device.ttyUSB0     ] INFO     |     crc16         : 57947
[2021-08-23 16:29:14,653] [sml.device.ttyUSB0     ] INFO     | SHUTDOWN
[2021-08-23 16:30:22,501] [sml.device.ttyUSB0     ] INFO     | PORT_OPENED
[2021-08-23 16:30:22,939] [sml.device.ttyUSB0     ] ERROR    | Traceback (most recent call last):
[2021-08-23 16:30:22,941] [sml.device.ttyUSB0     ] ERROR    |   File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/sml2mqtt/sml_device.py", line 95, in read
[2021-08-23 16:30:22,944] [sml.device.ttyUSB0     ] ERROR    |     value = sml_obj.get_value()
[2021-08-23 16:30:22,946] [sml.device.ttyUSB0     ] ERROR    |   File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/smllib/sml_fields.py", line 198, in get_value
[2021-08-23 16:30:22,948] [sml.device.ttyUSB0     ] ERROR    |     return round(self.value * 10**self.scaler, abs(self.scaler) + 3)
[2021-08-23 16:30:22,950] [sml.device.ttyUSB0     ] ERROR    | TypeError: type str doesn't define __round__ method
[2021-08-23 16:30:22,952] [sml.device.ttyUSB0     ] INFO     | ERROR
[2021-08-23 16:30:22,965] [sml.serial             ] INFO     | Port /dev/ttyUSB0 was closed
[2021-08-23 16:30:22,967] [sml.device.ttyUSB0     ] INFO     | PORT_CLOSED
[2021-08-23 16:30:23,159] [asyncio                ] ERROR    | Task was destroyed but it is pending!
task: <Task pending name='Task-14' coro=<stop_loop() done, defined at /home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/sml2mqtt/_signals.py:10> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0xb536e670>()]>>

Looks like a related error as it's the same exception type.

Oh, you can ignore the first line. It was my mistake. The relevant log starts at the second line.

Hmm - strange! Does it also display an error when using analyze (can you try a couple of times) or is it just during normal usage?

Ah, the only relevant part is in fact the one starting at the "PORT_OPENED" line at 16:30:22. The lines before were the -a run from before.

It does not display an error when running in analyze mode. I've tried a couple times, no error.

So, the relevant log part is in fact as follows, without analyze mode. Sorry for the confusion.

[2021-08-23 17:22:39,707] [sml.device.ttyUSB0     ] INFO     | PORT_OPENED
[2021-08-23 17:22:41,044] [sml.device.ttyUSB0     ] ERROR    | Traceback (most recent call last):
[2021-08-23 17:22:41,047] [sml.device.ttyUSB0     ] ERROR    |   File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/sml2mqtt/sml_device.py", line 95, in read
[2021-08-23 17:22:41,050] [sml.device.ttyUSB0     ] ERROR    |     value = sml_obj.get_value()
[2021-08-23 17:22:41,052] [sml.device.ttyUSB0     ] ERROR    |   File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/smllib/sml_fields.py", line 198, in get_value
[2021-08-23 17:22:41,054] [sml.device.ttyUSB0     ] ERROR    |     return round(self.value * 10**self.scaler, abs(self.scaler) + 3)
[2021-08-23 17:22:41,057] [sml.device.ttyUSB0     ] ERROR    | TypeError: type str doesn't define __round__ method
[2021-08-23 17:22:41,059] [sml.device.ttyUSB0     ] INFO     | ERROR
[2021-08-23 17:22:41,073] [sml.serial             ] INFO     | Port /dev/ttyUSB0 was closed
[2021-08-23 17:22:41,075] [sml.device.ttyUSB0     ] INFO     | PORT_CLOSED
[2021-08-23 17:22:41,247] [asyncio                ] ERROR    | Task was destroyed but it is pending!
task: <Task pending name='Task-20' coro=<stop_loop() done, defined at /home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/sml2mqtt/_signals.py:10> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0xb532a670>()]>>

I've also tried using the SmlLib in my own script. It works until I try to run parse_frame which gives me the following error:

Exception in callback SerialTransport._read_ready()
handle: <Handle SerialTransport._read_ready()>
Traceback (most recent call last):
  File "/home/pi/.asdf/installs/python/3.9.2/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/serial_asyncio/__init__.py", line 119, in _read_ready
    self._protocol.data_received(data)
  File "/home/pi/my_sml2mqtt/main.py", line 71, in data_received
    self.parser.parse(data)
  File "/home/pi/my_sml2mqtt/main.py", line 44, in parse
    parsed_msgs = sml_frame.parse_frame()
  File "/home/pi/.local/share/virtualenvs/sml2mqtt-h7SpFYOC/lib/python3.9/site-packages/smllib/sml_frame.py", line 82, in parse_frame
    raise ValueError(
ValueError: No start of SML Message found at 186: 0x1

Executing get_frame of the sml_reader and subsequently executing get_obis on the returned sml_frame work as expected. The above error is thrown when I execute parse_frame on the sml_frame instance returned by sml_reader.get_frame.

It seems there is still a wrong data type somewhere in the lib. I'll take a look at it tomorrow and at least dump the processed frame in the log.

Ah, I've figured out you cannot run sml_frame.get_obis and sml_frame.parse_frame directly after another. Probably because the sml_reader has some kind of cursor, right? Just like a StringIO object where you have to do a .seek(0) in order to reset the read cursor.

Now I can do parse_frame in my own script without the above mentioned error.

It seems there is still a wrong data type somewhere in the lib. I'll take a look at it tomorrow and at least dump the processed frame in the log.

Alright, I'll see what I can do with it in the meantime. As mentioned, I've had some success. Thanks a lot for your ongoing support!

Probably because the sml_reader has some kind of cursor, right?

Exactly!

Cool. So what remains is that weird error message from your sml2mqtt script... If I can help you in any way to analyze that, you know where you can find me :) :) :)

I added a workaround, it seems your device is reporting texts with a scaler.
Could you try again?

Yes, it's working now. Thank you very much.

Since it is only a limited output from the smart meter without entering the required PIN (which I still don't have yet), I could imagine other fields behaving as strangely. I'll of course get back to you in case that causes further problems. Shall I open a new issue then?

Never mind, I can confirm now that it is working, even with the extended data set (meanwhile I got the pin).

It works! Thanks again! Keep rocking!