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
69.82k stars 28.94k forks source link

dsmr integration and MT382 with optical probe #51271

Closed Bascht74 closed 3 years ago

Bascht74 commented 3 years ago

The problem

Hello, I have a MT382 smart meter with 8 tariffs and it uses DSMR (plain text).

Here is an example of the output via HTERM on Windows: /ISK5\2MT382-1008<\r> 0-0:96.1.1(314xxxxxxxxxxxxxxxxxxxxx37)<\r><\n> 0-0:128.20.0(016)<\r><\n> 1-0:0.9.2(210528)<\r><\n> 1-0:0.9.1(215658)<\r><\n> 1-0:1.7.0(001.322kW)<\r><\n> 1-0:2.7.0(000.000kW)<\r><\n> 1-0:1.8.0(010192.57kWh)<\r><\n> 1-0:1.8.1(006094.31kWh)<\r><\n> 1-0:1.8.2(001410.19kWh)<\r><\n> 1-0:1.8.3(000981.30kWh)<\r><\n> 1-0:1.8.4(001706.76kWh)<\r><\n> 1-0:1.8.5(000000.00kWh)<\r><\n> 1-0:1.8.6(000000.00kWh)<\r><\n> 1-0:1.8.7(000000.00kWh)<\r><\n> 1-0:1.8.8(000000.00kWh)<\r><\n> 1-0:1.2.0(106.732kW)<\r><\n> 1-0:1.6.0(007.072kW)<\r><\n> 1-0:2.8.0(006715.38kWh)<\r><\n> 1-0:3.8.0(000122.04kvarh)<\r><\n> 1-0:4.8.0(006255.99kvarh)<\r><\n> 1-0:0.2.2(Smart001)<\r><\n> 1-0:0.3.0(00500)<\r><\n> 1-0:0.3.1(00500)<\r><\n> 1-0:0.3.3(250)<\r><\n> 0-0:97.97.0(00000000)<\r>

However, the counter requires initialization via the optical interface in good old Germany: HEX 2F 3F 21 0D 0A ("/?!") at 300 baud/7E1 and afterwards it is possible to switch-over to 9600 baud: hex 06 30 35 30 0D 0A ("050")

see: https://github.com/lvzon/dsmr-p1-parser/blob/master/doc/IEC-62056-21-notes.md#sign-on-sequence

The P1 interface is not activated in Germany, the readout is only possible optically.

With the current integration this does not seem to be supported. The integration expects the data and does not ask for anything.

Is it possible to add optical readout with the integration? This could be done e.g. if no data comes after initialization > 15 seconds. Then "/?!" could be sent once with 300 baud/7N1 and checked if a response comes then. In this case the optical interface would be active and not the P1 interface. The rest of the integration could then be used "quite normally" - if I currently capture everything correctly...

Thx for an opinion,

Sebastian

What is version of Home Assistant Core has the issue?

core-2021.6.0b1

What was the last working version of Home Assistant Core?

-

What type of installation are you running?

Home Assistant OS

Integration causing the issue

dsmr

Link to integration documentation on our website

https://www.home-assistant.io/integrations/dsmr/

Example YAML snippet

- platform: dsmr
  port: /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0020-if00-port0
  dsmr_version: 2.2

Anything in the logs that might be useful for us?

tell me, if something is needed and how to get it...

Additional information

No response

probot-home-assistant[bot] commented 3 years ago

dsmr documentation dsmr source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

Hey there @robbie1221, mind taking a look at this issue as its been labeled with an integration (dsmr) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

RobBie1221 commented 3 years ago

Aside from the fact that this is an issue tracker and not a feature request board, your journey would have to start with the dsmr_parser library. It doesn't support sending data...

Bascht74 commented 3 years ago

@RobBie1221 Thx for your answer. I thought that your integration is processing the data of that library. It can send the data to the meter if it doesn't get any data and then let dsmr_parser process the answer.

But OK, as I am not a programmer I do not know what is the best way. I will ask the dsmr_parser library owner then if he is so kind.

I am as well not sure if it was an issue or not as it doesn't say clearly that it only support the P1 and not the optical recognition. At least I did not find it.

Thx,

Sebastian

RobBie1221 commented 3 years ago

As per Home Assistant rules, communication with devices should only be done through 3rd party libraries, so at least a library is needed.

The dsmr currently officially complies to specs from The Netherlands, Belgium and Luxembourgh. Other countries may work by accident.