-
Notifications
You must be signed in to change notification settings - Fork 64
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
Parsing fails on new Sagecom T210D #72
Comments
This is the data I get back:
|
I see the gas meter is not returning values. |
Did you already find the offending line? |
Offending line is It is parsed with: This is the same problem as in issue #51 and has to do with a wrong setup of the MBus on your side. 0-1:24.1.0(003) ==> Device Type Gasmeter The parser expects a timestamp and a gas meter reading. It finds someting else, therfore can not parse. Possible solutions:
As a structural solution for making the parser more robust, I see the following solution:
|
Yeah, I noticed the invalid data also (albeit, the date is valid, but it shouldn't be, as you can't state something happened with a future data). I think, the parsing should be more resilient. But I don't have clue how I could do that in this project, as I don't have experience in Python. I tried to run the unit tests, so I could add a failing test case that I could fix. But I don't understand how the tests can be run. |
One possible way to fix this, as commented above by lowdef, is to catch the datetime parsing error. I'm not sure whether it's the best way to solve the problem, but it seems to work fine for me for a while: value_types.py However, do note that I still needed to check for the empty value to clear the device info as well: code. Note that the check/clear code is outside the scope of |
I provided a pull request #74 |
Thanks, that would solve my problem 👌🏻 |
I just got a new meter, as I upgraded my 1x40A to 3x25A.
But when I connect it to my Home-Assistent, I no longer receive any data.
When trying to figure out why, I noticed the logs are getting filled with the same message every time the p1 message is received.
2021-01-08 19:31:14 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 119, in _read_ready self._protocol.data_received(data) File "/usr/local/lib/python3.8/site-packages/dsmr_parser/clients/protocol.py", line 96, in data_received self.handle_telegram(telegram) 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 59, in parse telegram[signature] = parser.parse(match.group(0)) File "/usr/local/lib/python3.8/site-packages/dsmr_parser/parsers.py", line 174, in parse return MBusObject(self._parse(line)) File "/usr/local/lib/python3.8/site-packages/dsmr_parser/parsers.py", line 153, in _parse return self._parse_values(values) File "/usr/local/lib/python3.8/site-packages/dsmr_parser/parsers.py", line 138, in _parse_values return [self.value_formats[i].parse(value) File "/usr/local/lib/python3.8/site-packages/dsmr_parser/parsers.py", line 138, in return [self.value_formats[i].parse(value) File "/usr/local/lib/python3.8/site-packages/dsmr_parser/parsers.py", line 284, in parse value = self.coerce_type(value) if value is not None else value File "/usr/local/lib/python3.8/site-packages/dsmr_parser/value_types.py", line 7, in timestamp naive_datetime = datetime.datetime.strptime(value[:-1], '%y%m%d%H%M%S') File "/usr/local/lib/python3.8/_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "/usr/local/lib/python3.8/_strptime.py", line 352, in _strptime raise ValueError("unconverted data remains: %s" % ValueError: unconverted data remains: 525
Hopefully you have an idea what caused this, and where I can look further.
Thanks in advance!
The text was updated successfully, but these errors were encountered: