Hi there, are more people experiencing issues with the telegram parser since the update of HA?
Iâm getting the following error in the log:
2017-06-11 10:34:40 ERROR (MainThread) [dsmr_parser.clients.protocol] failed to parse telegram
Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/deps/dsmr_parser/clients/protocol.py", line 103, in handle_telegram
parsed_telegram = self.telegram_parser.parse(telegram)
File "/home/homeassistant/.homeassistant/deps/dsmr_parser/parsers.py", line 57, in parse
raise ParseError('Telegram specification does not match '
dsmr_parser.exceptions.ParseError: Telegram specification does not match telegram data
Config:
sensor dsmr:
- platform: dsmr
# port: /dev/ttyUSB0
dsmr_version: 4
group:
meter_readings:
name: Meter readings
entities:
- sensor.power_consumption_low
- sensor.power_consumption_normal
- sensor.power_production_low
- sensor.power_production_normal
Anyone experiencing the same of having an idea whatâs the cause?
Yep! And you are most probably running Hass 46.0? If you update to 46.1 then the problems should be gone. I havenât tried this myself as I am not home thoughâŚ
Yes I am. Will update to 46.1 this evening and let you know if it helps.
Update: Unfortunately itâs still there:
Version:
pi@hassbian:/home/homeassistant/.homeassistant $ hass --version
0.46.1
If you are using a serial to tcp converter the serial settings should not matter. This is important information as that is a common cause for issues. Iâm curious why it would not work in this case.
What version DSMR is your device?
it worked at my home for months but after upgrade to 46.1 it doesnât work anymoreâŚ
What DSMR version?
Version 4, didnât change anything
Just got home from a long day. I think I installed 0.10.
I used
sudo pip3 install dsmr-parser==0.08
To install a previous version but that did not solve the issue.
It looks like itâs known and in hass 0.46.1 it should be fixed.
Can you try removing the contents of the deps/
folder and restarting HASS afterwards to reinstall dependencies? Nothing should be different between 0.45 and 0.46.1 for dsmr.py
so my only guess is some remnants of 0.46 are left behind in cache somehow. Please let me know if that doesnât work so we can investigate further.
I removed the deps folder and it was recreated during startup. HA did not start after restart but I did not have time to dive into it. My girlfriend needed some attention. I will definitely look into it later today.
Correction: HA did start. The removal did not have any effect. I tried it again with stopping the service, removing and then rebooting. I even installed parser 0.10 and after that 0.08. This did not help.
Installing parser will do nothing as HA manages its own dependences in the deps/
folder which override system installed packages. You can try to install it into the deps/
folder using the --target
argument to pip, but HA may overwrite the package at any time when updating.
There are no changes to dsmr.py
compared to 0.44 ($ git diff 0.44 0.46.1 homeassistant/components/sensor/dsmr.py
).
What version of HA did you guys update from?
Can you try putting the dsmr.py
file from an older version (https://github.com/home-assistant/home-assistant/commits/dev/homeassistant/components/sensor/dsmr.py) in the custom_components/sensor/
directory in you config and try which version works.
Otherwise we might have hit on an dependency like pyserial updating but that seems odd as I see no related changes (https://github.com/pyserial/pyserial-asyncio/compare/v0.3...v0.4)
Iâve tried to replace the dsmr.py with an older version.
Iâm not sure from which version I updated from, not a very old one. I was keeping it quite up to date.
Another idea: Could it be that the HA is using the Universal Time and the smart meter/parser is expecting local time?
Current default time zone: âEurope/Amsterdamâ
Local time is now: Fri Jun 16 11:34:51 CEST 2017.
Universal Time is now: Fri Jun 16 09:34:51 UTC 2017.
2017-06-16 11:36:40 ERROR (âŚ
I think the timezone should not matter.
Could you try installing the dmsr_parser outside of HA and try using the dsmr_console
command? https://github.com/ndokter/dsmr_parser#installation
dsmr_console -h
should give information to get started. This at least tells if there is nothing else wrong besides maybe some changes in HA.
When running the parser command I get this output:
pi@hassbian:~ $ dsmr_console --device /dev/ttyUSB0 --version 4
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib/python3.4/logging/__init__.py", line 978, in emit
msg = self.format(record)
File "/usr/lib/python3.4/logging/__init__.py", line 828, in format
return fmt.format(record)
File "/usr/lib/python3.4/logging/__init__.py", line 573, in format
record.exc_text = self.formatException(record.exc_info)
File "/usr/lib/python3.4/logging/__init__.py", line 523, in formatException
traceback.print_exception(ei[0], ei[1], tb, None, sio)
File "/usr/lib/python3.4/traceback.py", line 169, in print_exception
for line in _format_exception_iter(etype, value, tb, limit, chain):
File "/usr/lib/python3.4/traceback.py", line 146, in _format_exception_iter
for value, tb in values:
File "/usr/lib/python3.4/traceback.py", line 125, in _iter_chain
context = exc.__context__
AttributeError: 'NoneType' object has no attribute '__context__'
Call stack:
File "/usr/local/bin/dsmr_console", line 11, in <module>
sys.exit(console())
File "/usr/local/lib/python3.4/dist-packages/dsmr_parser/__main__.py", line 57, in console
loop.run_until_complete(protocol.wait_closed())
File "/usr/lib/python3.4/asyncio/base_events.py", line 271, in run_until_complete
self.run_forever()
File "/usr/lib/python3.4/asyncio/base_events.py", line 244, in run_forever
self._run_once()
File "/usr/lib/python3.4/asyncio/base_events.py", line 1081, in _run_once
handle._run()
File "/usr/lib/python3.4/asyncio/events.py", line 120, in _run
self._callback(*self._args)
File "/usr/local/lib/python3.4/dist-packages/serial_asyncio/__init__.py", line 399, in _call_connection_lost
self._protocol.connection_lost(exc)
File "/usr/local/lib/python3.4/dist-packages/dsmr_parser/clients/protocol.py", line 90, in connection_lost
self.log.exception('disconnected due to exception')
Message: 'disconnected due to exception'
Arguments: ()
0.047 kW
[numbers...] None
0 None
0 None
57.275 kWh
0.000 kW
0.380 kW
2017-06-18 12:26:17+00:00 None
0 None
1 None
0.000 kW
0 None
0.004 kW
0.000 kW
0 None
241.681 kWh
147.866 kWh
50 None
494.664 kWh
0001 None
None None
0.432 kW
0.000 kW
1 None
already a solution?
I have no DSMR4 device to test only DSMR3 and both are running latest 0.47 with no problems.
My guess is judging on speedycoâs dump the DSMR4 first telegram is received incomplete (serial input buffer has partial data) which causes an exception and the way these are now handled in HA is different then before 0.46.
I created a issue on github, please subscribe to this for updates as I will keep track of updates there: https://github.com/home-assistant/home-assistant/issues/8128
If others could please verify if they see the same behaviour as speedyco or if it is different, please post this info on the github issue. If you find anything else which you think might be related please share it as well.