Has been in my network for some time (next to an SMA EV Charger 22 wallbox) also an SMA inverter for a photovoltaic system and an associated SMA Sunny Home Manager. The latter is installed in such a way that it can not only measure the energy fed into the grid. In addition, it also measures consumption. This means you can view the current electrical energy supply at any time. This makes it possible to have a good overview of how much energy is being generated or consumed at any time.
This means that you can use as much energy as possible yourself (instead of feeding it into the grid) by using a high level of self-consumption of the energy produced.
This is already possible at SMA using a special app. However, this only allows processes to be automated to a limited extent. Ultimately, I would 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 be read out. I also have to say that the code was not created by me alone. I was inspired by various (unfortunately no longer known) sources. (If you find your code here, please let me know. Then I'll add the information here. :))
But now to my current Node Red code to be able to read out the data from an SMA Sunny Home Manager.
Safety instructions
I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/
Affiliate links/advertising links
The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other 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 for this and then install NodeRed on it is described in the following articles.
- RaspberryPi – setup for nerdiys!
- RaspberryPi – Tuee First configuration!
- RaspberryPi – Control the RaspberryPi via SSH
- NodeRed – Installing NodeRed on the RaspberryPi
- 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 | Screwdriver 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 case Buy at Amazon |
1x | Micro SD card 64GB Buy at Amazon |
1x | SMA Sunny Home Manager 2.0 |
SMA Sunny Home Manager requirements
In order for the data from your SMA Sunny Home Manager to be read, it should already be in operation and connected to your network. If you can already read the data from your inverter 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 in the article NodeRed - import and export node code described.
In order to use the node code linked below, you do not need 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 at the following link:
The data read is output in groups. Currently they are “only” displayed on the dashboard. Of course, you can also process it in other ways and, for example, find out the right time to turn on your washing machine. 🙂
More articles about Node Red
In the following categories you will find further links on the topic of Node Red.
Have fun with the project
I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂
PS 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 think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂
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, it keeps saying “Connecting” to me.
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
Hello,
a great script! How does the SunnyBoy communicate with the Home Manager? Is there a way to read the charge level and charge rate?
Greetings
Hi,
I installed the Home Manager 2.0 and SUNNY TRIPOWER 8.0 SE. The payload length here is 58. Do you have an idea how to get the appropriate specification?
Many thanks and greetings
Hi Andi,
Unfortunately I don't have the exact specifications.
Have you already tried to assign the values using trial and error? 🙂
Best regards
Fabian
I am also trying to understand the message that comes in. Did you already have any luck? My setup looks similar to yours and I'm also receiving 58 payload length.
Hi Fabian,
thanks for the great flow. I'm a beginner, but I really managed to display the data I wanted in HA. However, sending the data every 1s is too often for me. How can I change the flow so that the data is only sent every 2 or 3s
Greetings
Ren
Hi Ren,
actually there is no way to limit the reception interval of the data by manipulating the source itself since this is based on the received broadcasts. But you can use a limit node to limit the data. You have to put it between the “SMA EM” and the function node. In this you can then define the rate that fits best for you. 🙂
Best regards
Fabian
Hi Fabian,
Thanks for the great work! Runs very well! I have still one question. If I understand correctly, the solar yield is not recorded, correct? I first interpreted feed-in as such, but due to the lack of a finished system and test setup with only 2.7 kWp, I currently only get 0 because I don't feed anything into the public network. Is my assumption correct? I would then receive the solar yield directly from the inverter and not via the home manager?
Thanks and best regards
Thomas
Hi Thomas,
Thanks. 🙂 Yes, I understand it exactly the way you described it. I think you have to get this value directly from the inverter. Maybe. The information here will help you: https://nerdiy.de/de_de/howto-node-red-sma-sunny-solar-wechselrichter-daten-auslesen/
Best regards
Fabian
Hi Fabian,
Thank you, I've already tested them all. With the inverter, however, my Node Red instance is constantly failing. But only with the Tripower 10 SE. It works with my Sunny Boy 5.0.
Let's see if I can find the error, but for now I'll keep playing. 😉
Best regards
Thomas
All right, once you find out more I'd be happy to receive feedback. 🙂
Good luck!
Fabian