---
title: 'sma Energy Meter Read Multicast'
url: 'https://willifix.net/blog/sma-energy-meter-read-multicast'
markdown: 'https://willifix.net/blog/sma-energy-meter-read-multicast.md'
date: '2024-04-03'
description: "I have had a PV system for almost 4 years. This includes an energy meter which I would like to install in my existing home automation system. To get the data from the energy meter, I looked at the technical specifications on the manufacturer's website and discovered that the energy meter sends data…"
---

# sma Energy Meter Read Multicast

## [sma Energy Meter Read Multicast](https://willifix.net/blog/sma-energy-meter-read-multicast)

    3rd Apr 2024  

I have had a PV system for almost 4 years. This includes an energy meter which I would like to install in my existing home automation system. To get the data from the energy meter, I looked at the technical specifications on the manufacturer's website and discovered that the energy meter sends data via multicast. To get this data into a usable format, I wrote the following code snippet in Nodered:

```javascript
// Script von Raffael Willems
// Aktueller Verbrauch
var eMeter = msg.payload;
var AktVerbrauch = {};
msg = {};
var deco = eMeter.toString('hex');
AktVerbrauch=deco.substr(64,8);
AktVerbrauch=parseInt(AktVerbrauch,16)/10;
if (AktVerbrauch <40000)
{
msg.payload = AktVerbrauch;
}
// Gesamtverbrauch
var GesVerbrauch = {};
msg2 = {};
GesVerbrauch=deco.substr(80,16);
GesVerbrauch=parseInt(GesVerbrauch,16)/3600000;
if (GesVerbrauch < 40000)
{
msg2.payload = parseFloat((GesVerbrauch).toFixed(0));
}
// Aktuelle Einspeisung
var AktEin = {};
msg3 = {};
AktEin=deco.substr(104,8);
AktEin=parseInt(AktEin,16)/10;
if (AktEin <40000)
{
msg3.payload = parseFloat((AktEin).toFixed(2)); // + 'W';
}
// Gesamt Einspeisung
var GesEin = {};
msg4 = {};
GesEin=deco.substr(120,16);
GesEin=parseInt(GesEin,16)/3600000;
msg4.payload = parseFloat((GesEin).toFixed(0));
return [msg,msg2,msg3,msg4]
```

The complete Flow for Nodered is also available: [flows.json](https://willifix.net/blog/sma-energy-meter-read-multicast/flows.json)\[mermaid\] flowchart LR A\[fa:fa-tower-cell multicast\\n239.12.255.254:9952\]--> B(fa:fa-florin-sign meter auslesen) B --> C\[aktuellerBezugEV\] B --> D\[GesamtVerbrauch\] B --> E\[aktuelleEinspeisung\] B --> F\[Gesamteinspeisung\] style A fill:#999999 style B fill:#FFCC66 style C fill:#6699FF style D fill:#6699FF style E fill:#6699FF style F fill:#6699FF \[/mermaid\]

 [ Previous Post](https://willifix.net/blog/waybar-vpn-toggler) [Next Post ](https://willifix.net/blog/install-racadm-for-idrac-on-proxmox-7-8)

---

## Navigation

- Parent: [Blog](https://willifix.net/blog.md)
- Previous: [install racadm for IDRAC on Proxmox 7/8](https://willifix.net/blog/install-racadm-for-idrac-on-proxmox-7-8.md)
- Next: [waybar vpn toggler](https://willifix.net/blog/waybar-vpn-toggler.md)
