home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.16k stars 30.2k forks source link

DSMR4 not working since 0.46 #8128

Closed aequitas closed 6 years ago

aequitas commented 7 years ago

Multiple users report DSMR4 not working since 0.46, even after reverted change due to DSMR5 changes (https://github.com/home-assistant/home-assistant/issues/7893).

Still under investigation for root cause, discussion at: https://community.home-assistant.io/t/support-for-reading-dutch-smart-meter-electricity-gas-p1-port/1676/238

Probable cause is initial DSMR4 telegram is incomplete (due to serial buffers) but raises an exception instead of ignoring (DSMR4 has CRC checksumming compared to other versions raising a different exception). And HA behaviour has changes since version 0.46.

Phontana commented 7 years ago

Is this also not working with v 0.10 of dsmr_parser? I noticed it wasn't included in 0.47 yet. I have a dsmr 4 meter and I don't see the exceptions mentioned in the forum thread.

aequitas commented 7 years ago

The version update was rolled back because it was not tested fully and I think it was cause of the issue. But maybe it was unrelated. I've had no time to investigate yet.

balloobbot commented 7 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

Phontana commented 7 years ago

It isn't fixed since dsmr_parser 0.8 is still the version used by Home Assistant.

aequitas commented 7 years ago

@Phontana what are the specific issues you are experiencing? Can you share logging and your setup (hardware used for connecting dsmr).

Phontana commented 7 years ago

The issue I am experiencing is that dsmr_parser is working with version 4, but it keeps logging exceptions instead of logging them as warnings (and therefore giving the option to exclude them from the logs). I also mentioned this in this issue.

This is fixed in 0.10 of dsmr_parser but that version is not included in Home Assistant.

aequitas commented 7 years ago

@Phontana are you using a DSMR5 device? If so we can pickup this PR again as it lacked v5 testers and was merged to early which is why it was reverted: https://github.com/home-assistant/home-assistant/pull/7535

aequitas commented 7 years ago

I updated the dsmr5 branch, if you can try if this file works on your configuration: https://raw.githubusercontent.com/aequitas/home-assistant/dsmr5/homeassistant/components/sensor/dsmr.py

Just place it in custom_components/dsmr/ in your configuration directory to overwrite the installed version.

Phontana commented 7 years ago

@aequitas No, I am using a version 4 device. But I can try your code if you like?

aequitas commented 7 years ago

DSMR4 also uses crc checking indeed, I forgot and thought only DSMR5 had this issue. Would be useful if you could give it a try. Let me know if the instructions are unclear or you need more help.

Phontana commented 7 years ago

I placed your code in the custom_components folder and restarted Hass, but it still shows CRC checksum exceptions in my log:

2017-09-15 10:55:06 ERROR (MainThread) [dsmr_parser.clients.protocol] failed to parse telegram
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/dsmr_parser/clients/protocol.py", line 100, in handle_telegram
    parsed_telegram = self.telegram_parser.parse(telegram)
  File "/usr/local/lib/python3.6/site-packages/dsmr_parser/parsers.py", line 47, in parse
    self.validate_checksum(telegram_data)
  File "/usr/local/lib/python3.6/site-packages/dsmr_parser/parsers.py", line 88, in validate_checksum
    expected_crc
dsmr_parser.exceptions.InvalidChecksumError: Invalid telegram. The CRC checksum '14034' does not match the expected '35424'
Phontana commented 7 years ago

How can I check if the correct file in custom_components is being used?

aequitas commented 7 years ago

There is not really a way to check afaik. You could check if 0.10 version of dsmr_parser is installed in the deps folder. As that is one of the effects.

Phontana commented 7 years ago

I manually installed version 0.10 in my Docker. Since I'm running Docker and therefore using a virtual environment, my deps/ folder is empty. The custom_components/ option did not work, but I managed to install 0.10 anyway. It is running fine without issues and I don't see any checksum exceptions (or warnings actually, as this was fixed in 0.10).

Phontana commented 7 years ago

@aequitas I just checked again and it is still running fine with 0.10. I suppose I can't do any more testing regarding DSMR v5. Maybe we should include 0.10 in the next Hass release?

aequitas commented 7 years ago

I'll have to do some more testing myself. As last time releasing this to soon resulted in it breaking for everyone. I'll check in later.

aequitas commented 7 years ago

I've been running the patched component for a few days now without problems. However since the last change didn't go so well I'd like to get some more testers (preferably v4 and v5) before pushing the update public. As I don't know if I can dedicate the time needed to test/support an update in the upcoming weeks and I would hate to revert it again if to many people experience issues.

Phontana commented 7 years ago

Same here. Running for over a week without any problem. I would be nice if more people were able to test this.

AlexMekkering commented 7 years ago

At my side (DSMR4), Homeassistant 0.55.0.dev0 runs just fine with dsmr_parser 0.11.

aequitas commented 7 years ago

@AlexMekkering you are using the updated version of the dsmr component or also just manually updated dsmr_parser python package?

AlexMekkering commented 7 years ago

I just took a fresh clone of the dev branch (0.55.0.dev0) which already uses dsmr_parser 0.11, didn't make any changes and just ran hass to test it which works just fine. I hadn't seen your PR yet so took the time to take your aequitas/dsmr5 branch just now and it seems to be working fine as well.

aequitas commented 7 years ago

Ok, so I totally missed that PR somehow :).

AlexMekkering commented 6 years ago

I think this issue can be closed because it is solved by hass 0.55 which includes dsmr_parser 0.11.

balloobbot commented 6 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1: