Reading Energy Data from HAN Port?

Hi guys, I have already googled a bit and searched here in the community forum, but could not find a satisfactory answer so far.

I live in Germany and our electricity provider has installed a LTE smart meter like this inside the electricity meter:

I do not have access to most of the connections on the smart meter as they are sealed. However, the HAN port is openly accessible.
If I have read correctly, real-time data on consumption is also provided via this HAN port.

Unfortunately, it seems that most Home Assistant compatible devices only support the P1 port for reading consumption data. I would prefer a device like the SlimmeLezer to get the consumption data. However, this is not compatible with the HAN port. :frowning:

Therefore, I wanted to ask if anyone else has a smart power meter with HAN port and already successfully reads consumption data. How did you do that?

Best regards
Simon

1 Like

Hi. Seems to be some kind of scandinavian standard.
You’ll probably need an esp and a mbus to ttl converter. The biggest challenge, however is probably going to be the protocol, for which a custom component is probably needed.
The protocol seems to be very well documented.

You can have a look at the Soliva, Ampvint or Foxess projects here on the forums in the Esphome section. By swapping the serial parsing with the Han protocol from your meter you should be able to get very far.

Thanks for the tips. I have found here in a Norwegian online store even once a device based on ESP32 that apparently can read data from a HAN port:

However, I am not sure whether the transmission protocol is uniform and the Norwegian readers also work in Germany.
But maybe I just give the Norwegian device a try, or write to the Norwegian store if there are already experiences with German smart meter gateways with HAN port.

Unfortunately, the electricity smart meters, which have been mandatory in Germany for some time, are poorly documented in Germany, for end users. I still wonder today who came up with the stupid idea of having to unlock additional functions of the electricity meter by a flashlight!!!
For all German-speaking users, there is also a very funny satirical contribution from Extra3:

Yeah, I know that video. It’s absolutely hilarious :joy:.
I have one of those and had to unlock in that way. But to be fair, it works absolutely reliable!

I would definitely go for the ready build solution you have found. Ask the developer if it’s compatible with your meter. If he doesn’t know perhaps he is even willing to loan you one in the interest of finding out.

By the way; you’ll probably also have to unlock yours. But apparently the energy provider can do it for you remotely.

It might be interesting to have a look at this approach to extract data out of the HAN port:

But it seems to be a long way to create the firmware version compatibility and to transport the extracted data via node red into Home Assistant.

Maybe a quick solution in the short run would be to use the ir interface of the power meter.

Hi CM000n!

Did you try the norwegian device and did it work on the german gateway’s HAN port?
I’m also looking into this and would be interested in a working device.

Best Regards

Hello, unfortunately not. The distributor of the Norwegian device was very nice and helpful, but could not give me any information about the functionality in Germany.
From my network operator, I have unfortunately not received any information at all.
To just try out the device was then unfortunately too expensive for me and I retrieve the data now simply via infrared and SML. This works perfectly and cost me only 30€ for the hardware.

The HAN Port of the Smart Meter Gateway and the HAN Port of the Scandinavian gateways are totally different! The German HAN Port is RJ45 and just an acronym for “Home Area Network”. The Scandinavian Han Port is a different plug…I also would be interested in reading data over the PPC gateway mentioned in the first post…

The german HAN Port is well documented. The public standalone Software for attaching HAN Port is called TRuDI. Technically, it’s an eth-network-interface with ipv4.

The IP Network configuration of HAN Port is really stupid:

  • it uses dedicated IP Adress (192.168.1.200/24) and the SMGW Administrator (in my case Schleswig-Holstein Netz AG struggles since 6 Months to activate the HAN Port in my home, fix the TAF assignments in my Power-contract and provide Credentials of my SMGW.
  • Btw, the documentation for network configuration is still incorrect on several customer Webportals [e.g. SH-Netz, BW-Netz)

my conclusions till now:

  • TRuDI is working in a dedicated network (PC with IP 192.168.1.100 and HAN Port of SMWG with IP 192.168.1.200)

  • a dedicated Network device (maybe a docker container) with IP Adress on 192.168.1.x/24 can be used to communicate with the SMGW via HAN Port on the Home assistant Supervisor.

  • https is uses by SMGW without certificates. no WebUI is present and no login-form for authentication. The Web API requires basic authentication.

  • struggeling around by integrate HAN Port in my LAN on my firewall to run TRuDI from my PC within LAN. (SSH Portforwarding and also NAT ist not working)

  • maybe all SMGW Vendors in germany cook with the same water and any implementation of HAN Port will work with Home Assistant.

  • this is NOT a HAN Port: swedish energy providers may use a complete different approach for endcustomers by providing the P1 Protocol on RJ11 Jack ( GitHub - psvanstrom/esphome-p1reader: ESPHome custom component for reading P1 data from electricity meters.)

1 Like

In Finland some companies provides Aidon meters with HAN port. I don’t have this yet but requested to have it some day.

Specs: https://www.elenia.fi/files/5b4d7492d2125ed79a8f1424cd5c4539ba360090/aidonfd-rj12-han-interface-en-v17a.pdf

Did you make any progress with this? We just got our new smart meter with a PPC gateway installed.

Have you already found a solution to your problem? I have the same SMGW and have connected the HAN interface to the network via LAN cable. The instructions for the SMGW can be found here: https://www.ppc-ag.de/wp-content/uploads/2022/01/Handbuch-fuer-Verbraucher.pdf

The trick is to give the computer an additional IP from the SMGW network, as the SMGW network settings cannot be changed. I have also found a script with which I can get the current meter reading for the supply each time it is called up. The script can be found here: Python script to read data from PPC Smart Meter Gateway Customer Interface (SMGW) via the HAN interface · GitHub

Edit:
But I have no idea how to integrate this Python script into Home Assistant so that it delivers its meter reading every 10 minutes. Since the script imports other modules, simple integration into HA is not possible, as I have learned. Everything else like pyscript or similar is beyond my skills. Do you have any ideas?

Maybe try an approach via nodered and nodered companion.

There is a Node for Reading values available:

Thanks for the link. For me personally, Node-RED is not a good idea. It just adds another layer of complexity to the stack. I try to avoid this escalation in my setup.

I have managed to get the data from the SMGW. I now have the script for reading executed by Home Assistant itself.

With the help of this custom component: GitHub - AlexxIT/PythonScriptsPro: Advanced version of python scripts for Home Assistant without limits, which can be installed with HACS and with the help of this blog post (in German): Eigene Python Scripte in Home Assistant ausfĂĽhren - smarterkram.de

At the end of the Python script, only the feedback to HA has to be inserted as a sensor. For me:

Ergebnis1 = str(result_data['timestamp']+ " " + result_data['value']+ " " + result_data['unit'])
Ergebnis_kWh = str(result_data['value'])
hass.states.set('sensor.smgw_ppc1', Ergebnis_kWh, {
    'unit_of_measurement': 'kWh',
    'friendly_name': 'PPC SMGW1 Verbrauch',
    'device_class': 'energy',
})
logger.info("SMGW Ergebnis: " + Ergebnis1)

1 Like