esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
420 stars 26 forks source link

Support Kamstrup Omnipower energy meter #1401

Open cnrd opened 3 years ago

cnrd commented 3 years ago

Describe the problem you have/What new integration you would like

Add support for the Kamstrup omnipower energy meter that is used in parts of denmark.

Please describe your use case for this integration and alternatives you've tried:

An easier way for people to get data from the energy meter.

Additional context

This repo https://github.com/Claustn/esp8266-kamstrup-mqtt already contains a simple implementation that can be deployed on an esp.

The user will need to supply 2 keys that they need to get from the energy company.

Hedda commented 3 years ago

Wondering if you mean communication via the optical eye head and/or via the HAN-port on those since they have two interfaces?

https://blog.sintef.com/sintefenergy/han-port-smart-meters-ams/

Noted that apparently SME energy meters use DLMS/COSEM protocols and some use a variant of IEC62056-21 Mode D protocol:

https://github.com/pwitab/iec62056-21

https://www.kode24.no/guider/smart-meter-part-1-getting-the-meter-data/71287300

https://hanporten.se

https://hanporten.se/norska/protokollet/

https://hanporten.se/svenska/protokollet/

Note! DSMR Slimme Meter integration notes that smart meters with a ‘HAN port’ are currently not supported as of yet, so I guess it means that it will not work with DSMR in ESPHome using SlimmeLezer hardware since HAN interface is not P1 monitor compatible?

https://esphome.io/components/sensor/dsmr.html

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

https://github.com/ndokter/dsmr_parser

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

https://esphome.io/components/sensor/dsmr.html

https://www.zuidwijk.com/product/slimmelezer/

https://github.com/zuidwijk/dsmr/

cnrd commented 3 years ago

Sorry for not getting back to you earlier.

I was referring to communication on the HAN port.

The primary reason I'm requesting this is to get support for reading data from HAN port based meters from a more mature codebase/solution. All of the current solutions are not really very user friendly, so adding support in esphome would make it more accessible to more users.

I was thinking that configuring it in esphome should expose all of the avaliable data points as sensors in hass (just as what the code in the linked repo does to mqtt), but it would probably be a nicer experience, if hass also understood what it received in a more structured way compared to just dumping a bunch of sensors.

Hedda commented 3 years ago

Does your specific smart interface module in your Kamstrup Omnipower have an RJ45 interface (a.k.a. Norwegian RJ45 HAN-port standard) or RJ11 (a.k.a. Swedish HAN-port standard, which I understand in turn is a variant of the P1/H1 port using DSMR protocol)?

Google search says that they at least sell an Kamstrup HAN-module with "HAN-NVE" RJ45 HAN interface with part number 6840004 which according to its specifications listed in the data sheet it looks like the reader needs to comply with MBUS EN-13757-2 standard as per recommendation from NVE (Norwegian Water Resources and Energy Directorate) for Norway, a.k.a. AMS+HAN version 2.0 or IEC 62056-7-5, annex D ”MBUS” slave, e.g. an IEC 62056-21 protocol mode B client.

https://www.nek.no/wp-content/uploads/2018/10/Kamstrup-HAN-NVE-interface-description_rev_3_1.pdf

https://www.nek.no/wp-content/uploads/2017/10/AMS-HAN-personvernnotat-h%C3%B8ringsversjon.pdf

https://byggebolig.no/imageoriginals/88b3d1774ecb41e6a3fe067ae9e6a893.pdf

https://www.energiforetagen.se/globalassets/energiforetagen/det-erbjuder-vi/publikationer/branschrekommendation-lokalt-granssnitt-v1-2-2018.pdf

https://www.utomhusliv.se/wp-content/uploads/2020/10/Specifikation-f%C3%B6r-HAN-modulen-f%C3%B6r-elm%C3%A4tare-engelska.pdf

Google also says that Aidon AMI system smart meters use the same type of HAN-NVE HAN with RJ45 port with M-Bus interface:

https://www.skekraft.se/wp-content/uploads/2021/03/Aidon_Feature_description_RJ45_HAN_Interface_EN.pdf

https://www.tekniskaverken.se/siteassets/tekniska-verken/elnat/aidonfd-rj45-han-interface-se-v13a.pdf

Again there looks to be some guides for parsing the protocol and getting the data through some kind of M-Bus converter here:

https://www.kode24.no/guider/smart-meter-part-1-getting-the-meter-data/71287300

https://github.com/roarfred/AmsToMqttBridge/blob/master/Samples/Kaifa/readme.md

https://github.com/roarfred/AmsToMqttBridge/blob/master/Samples/Kamstrup/obisdata.md

https://hanporten.se/norska/protokollet/

https://github.com/pwitab/dlms-cosem

"The meter acts as Mbus master pushing data. To read the information, a circuit for Mbus' slave is needed."

"They are following the DLMS (Device Language Message Specification) protocol and are sent inside HDLC frames and contains OBIS (Object Identification System) codes that describes the electricity usage. Everything is part of IEC 62056 which is a set of standards for electricity metering data exchange."

PS: If ask for HAN-NVE (a.k.a. Norwegian RJ45 AN-port standard) interface then maybe change topic making subject more clear?

jesperrs commented 1 year ago

This may be made as an extention to the "DSMR Component"...