For some time now, there has also been an SMA inverter for a photovoltaic system and an associated SMA Sunny Home Manager in my network (in addition to an SMA EV Charger 22 Wallbox). The latter is installed in such a way that it cannot only measure the energy fed into the grid. In addition, it also measures consumption. So you can look at the current purchase of electrical energy at any time. This makes it possible to have a good overview of how much energy is being generated or consumed at any time.
In this way, you can use as much energy as possible yourself (instead of feeding it into the grid) through a high level of self-consumption of the generated energy.
This is already possible at SMA using a special app. However, processes can only be automated to a limited extent. Ultimately, I would also like to be able to read and use this data for my own SmartHome system.
The Node Red code presented below is a first start. This means that the most common consumption and producer data can already be read out. I also have to say that the code was not created by me alone. I got my inspiration from various (unfortunately no longer known) sources. (If you find your code here, please let me know. Then I'll add the info here. :))
But first to my current Node Red code to be able to read out the data of an SMA Sunny Home Manager.
Safety instructions
I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance. https://www.nerdiy.de/en/sicherheitshinweise/
Affiliate links / advertising links
The links to online stores listed here are so-called affiliate links. If you click on such an affiliate link and store via this link, Nerdiy.de receives a commission from the online store or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support Nerdiy.de in being able to offer further useful projects in the future. 🙂
Requirements
Helpful articles:
So that you can use NodeRed, NodeRed should of course already be installed on your Raspberry Pi.
How to prepare a Raspberry Pi and then install NodeRed on it is described in the following articles.
- RaspberryPi - Setup for nerdiys!
- RaspberryPi - The first configuration!
- RaspberryPi - Control the RaspberryPi via SSH
- Node Red - Installing Node Red on the Raspberry Pi
- NodeRed - Install new nodes
- NodeRed - Import and export node code
In the following lists you will find all the parts you need to implement this article.
Required tool:
Number | Link |
---|---|
1x | Screw driver set Buy at Amazon |
1x | SD card reader Buy at Amazon |
Required material:
Number | Link |
---|---|
1x | Raspberry Pi Buy at Amazon |
1x | Raspberry Pi power supply Buy at Amazon |
1x | Raspberry Pi housing Buy at Amazon |
1x | MicroSD card 64GB Buy at Amazon |
1x | SMA Sunny Home Manager 2.0 |
SMA Sunny Home Manager requirements
So that the data from your SMA Sunny Home Manager can be read, it should already be in operation and connected to your network. If you can already read out the data from your device with the SMA app, everything should be set up correctly.
Import Node Red code
In this section you will find the Node Red code you need. How you can import this into your NodeRed environment is described in the article NodeRed - importing and exporting node code.
In order to be able to use the node code linked below, you do not have to make any changes. The data is read from the Home Manager's multicast messages and should therefore be directly available.
You can find the Node Red code in the Nerdiy Git repository under the following link:


The data read out are grouped. They are currently "only" displayed on the dashboard. Of course, you can also process them in other ways and find out the right time to switch on your washing machine, for example. 🙂
More articles related to Node Red
In the following categories you will find further links on the subject of Node Red.
Have fun with the project
I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂
P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate that I share this information with you, I would be happy about a small donation to the coffee box. 🙂
Thank you for the great work. I imported the code into my Node-Red of my Home Assistant system. Unfortunately I get an error with the buffer-parser. This would be unknown.
Unfortunately, I am a complete beginner in Node-Red.
Do you have any tip what I could check?
Oh sorry, found out. I only had to install the buffer parser 🙂
Hey Toby,
just simply install the appropriate node over the palette. 🙂
Good luck with it and best regards
Fabian
Hello Fabian,
me again. I noticed that the firmware version unfortunately does not fit exactly. For me this is 2.12.3.R (is a new beta version). Unfortunately, 2.0c.3.R is displayed.
0C should actually be a 12.
If I change the type in the buffer-parser Measurements from hex to byte, it is displayed correctly for me.
You can check it and update the template if necessary.
Hey Toby,
thanks for the hint. Corrected the template. 🙂
Best regards
Fabian
Hello,
First of all great work, exactly what I was looking for.
However, I have a question about the flow.
First of all: I am an absolute newbie when it comes to Home Assistant and Node-Red.
How do I get some of the measured values back in Home Assistant in order to visualize them there or process them further.
I can't create a node that only contains one value (e.g. grid-feed total).
greeting
Rico
Hi Rico,
you can transfer data from NodeRed to HomeAssistant with the homeassistant websocket nodes. (https://flows.nodered.org/node/node-red-contrib-home-assistant-websocket)
Unfortunately I don't have an example (yet). Which of the measurement data do you want in the HomeAssistant? 🙂
Best regards
Fabian
Hello Fabian,
As measured values, I only wanted the current purchase and feed-in
As I said, I'm already failing at just picking up a single value from the function node and outputting it as a debug msg.
Greetings Rico.
Hi Rico,
what single value would you like to get out of a function node? Then I can help you specifically. 🙂
You know that you can also integrate the SMA devices directly via the integration into HomeAssistant? Then you don't need to go through NodeRed. 🙂
Best regards
Fabian
Hi Nerdy,
retrieving the data from the HomeManager works fine , but I notice , as soon as I enable the UDP node on port 9522 in Nodered , the SMA chain doesn't like it , and for example the SunnyBoyStorage is not longer able to connect to the HomeManager , and I get serious connection issues , as I read the log files.
My config is Sunny Home Manager 2.0, Sunny Boy Storage 3.7, Sunny Tripower 6.0
Do you have any suggestions regarding this ?
Kind Regards, Peter
Hi Peter,
hmm that sounds strange. I couldn't observe anything like this. Might be that this is due to the different setup since I do not have the battery storage in my setup. :/ Do you mind sharing some of the (anonymized) log entries?
Best regards
Fabian
Hello,
That looks great and seems to be exactly the basis for measuring the PV surplus with my "Homematic IP CCU3" and then controlling consumers via Homematic IP.
However, I keep getting "Connecting" displayed.
What could be the reason?
Many thanks, works right away and exactly what I was looking for to set up my other controls - great!
Gladly! Good luck. 🙂
Hello,
I hope you can help me as a HA newbie.
I integrated everything according to your instructions, unfortunately my flow doesn't say connected like yours.
but connection is established.
Do I have to enter an IP address or what am I doing Flasch.
The SMA Home Manager is in the Sunny Portal and has been writing data there for a long time
I have an SMA Home Manager 2.0, could that be the reason?
Greetings Mathias