Reading Energy Data from HAN Port?

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:

2 Likes

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.)

3 Likes

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)

2 Likes

Wouldn’t the homewizard P1 be suitable solution? Plugs into the HAN port and HA has an integration available for it.

Hi,
I now received a letter from my electricity provider (Westnetz) as well that they will be installing this same smart meter somewhere in he upcoming weeks. Is this PPC smart meter installed as a gateway in addition to the allready existing meter or is it replaced entirely?
Currently im reading out my meter via infrared on ESPHome. You mention you are also doing this with the PPC meter, but it doesn’t seem to have any IR interface. So hence my question whether the old meter is replaced or expanded by the ppc meter.

In our case (EnBw) it is an extension to the existing Itron electricity meter.

The Homewizard device is not compatible with the HAN port used in Germany, as it uses a completely different protocol @oli3000 .
Even if the connection fits, no data can be read out with it.

Thanks, for confirming! That would be great news, since i wouldn’t have to change anything (with the added risk of messing up the energy dashboard).

Thanks a lot for your notes here!
My two cents on the SmartMeterGateWay (some of the info gotten from the provider OB-Netz):

  • connecting over HAN with user:pass works only AFTER your network electricity provider updated those in the SMGW from remote
  • my SMGW (PPC brand) has always the IP address 192.168.1.200/24 and there is no way to change it or convince it to get a different address over DHCP
  • in my case the connection is https (port 443) with authentication (user and pass) and a self-signed certificate (so you have to click the corresponding exception in your browser)
  • the SMGW fetches and records consumption values every 15 minutes ONLY
  • the recorded values are sent once a day to the electricity provider

This Trudi Manual (in German) describes how to setup an additional IP on your computer to be able to connect to the SMGW:

AFAIK, your PC/RasPi must be connected directly to the SMGW or at least to the same network switch - otherwise you need to do some bridging tricks in your network (unless your whole network has addresses like 192.168.1.xx).

After connecting the SMGW shows some internal web portal with the consumption values that it sends periodically to the provider.
The same values can be fetched by python scripts like this:

or the node-red module linked somewhere above.
If you have the user and pass, you can also install Trudi and read that data.

But those are never current consumption values! They are taken every 15 minutes and stay unchanged for 15 minutes until the next reading.
So in my case, there is no chance to actually read accurate consumption values from SMGW, like every minutes
I’ll have to go back to the IR interface of the electricity meter.

1 Like