I recently added an SMA EV Charger 22 Wallbox to my network. Of course, this is primarily used to charge an electric car.
Nevertheless, I was of course curious which values could be read out and processed there.
The Node Red code presented below is my current status. It can already be used to read out the most common consumption and production data. So you can access individual values of the electricity network as well as the connected car.
More information is summarized in this article.
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. 🙂
So that you can install new nodes, NodeRed should of course already be installed on your RaspberryPi.
How to prepare a RaspberryPi 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
- NodeRed - Installing NodeRed on the RaspberryPi
In the following lists you will find all the parts you need to implement this article.
|1x||Screwdriver set Buy at Amazon|
|1x||SD card reader Buy at Amazon|
|1x||IKEA FYRTUR roller blind|
|1x||SONOFF Zigbee 3.0 USB Dongle Plus Buy at Amazon|
|1x||USB extension cable Buy at Amazon|
|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|
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 with your ESPEasy device, you have to make a few changes. These are described in the next section.
You can find the Node Red code in the Nerdiy Git repository under the following link:
In the gallery below you can see a photo of the flow in the configuration view. As you can see, I was able to assign/read most of the values. For some (in my opinion less important) the correct assignment is still missing. If you find this out, please leave me a comment.
In order for the Node Red Flow to work correctly, you must set the access data for the standard user of your wallbox in the area marked in red.
The retrieved data is displayed in the dashboard. Of course, you can adapt the code as you wish and process the recorded data further.
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. 🙂
how can I adapt the code to be able to read the data from the inverter and the battery inverter?
I look forward to an answer.
I will publish the instructions/code for the inverter soon. 🙂
I have just published the information to read out the Sunny Home Manager. 🙂
I always get the message connecting to distribute_wallbox_data. So I get no connection although the access data to 1000% are correct.
I then installed Mosquito MQTT and tested it successfully, but it didn't help.
Do you have a tip what else I should do besides importing your flow and entering the login data?
just to rule that out (sorry for the potentially stupid question) you entered the access data to your MQTT server in the "distribute_wallbox_data" node, right? Not the login data for the Wallbox. 🙂
the code works fine, but now I'm wondering whether the constant reading and writing is harmful to the wallbox. Can you tell me more about that?
I have regulated it so that I first query the house consumption and if it is over 10kW the box is only queried.
Only with excess charging does this not work because of the lower charging capacity.
Even if I don't know the SMA software in detail (of course), I wouldn't worry about it. On the one hand, the data is only read and not actively set which parameters. There shouldn't be a writing process there.
If one should take place (which, as I said, I find very difficult to imagine because it simply makes no technical sense or is even unwise), it is now actually part of the manufacturer taking care of the "wear leveling".
Either too frequent write operations would be prevented or handled accordingly in order to prevent the memory cells from wearing out too early.
I've been using the code shown for about a year and so far everything works as it did on day one. 🙂
Of course I can't give you a guarantee. :/
Thank you for your detailed reply. Wear leveling didn't tell me anything at all. Learned something again.
Hi Florian, no, those are the correct login details for the wall box. 🙂
With the Mqtt I tested whether it might have to be installed. But I think I was on the wrong track there.
I then tested further and found that running it manually to get the token works on my PC in the DOS box, but if the command is run via Node Red from my Home Assist installation, there is no response. This is empty, which means that I logically get a json parse error. I think that's the main problem for me right now.
Do you have to install anything else to be able to issue these commands?
You only need the mqtt part if you want to forward the retrieved data to an MQTT server. If you don't need it, you can also delete the MQTT node. 🙂
It just occurred to me that the "curl" package might not be installed. This is necessary to retrieve the data. Can you test whether curl is installed by typing "curl -I google.de" into the terminal of your HomeAssistant? (The command just pulls the header from google.de and gives you the info).
I finally found the problem thanks to your tip about running curl in the terminal:
The curl command must not be in double quotes after the -d but must be in inverted commas. And already I get a result and everything works.
Now I'm going to take a closer look at everything.
good to hear it's working now. Thanks for the feedback and have fun with it. 🙂
I get the status "connected" under "distribute_wallbox_data" but the dashboard does not display any values. What could it be?
without changes, the specified code does not output any data on the dashboard. The "distribute_wallbox_data" node is used to forward the data via MQTT to an MQTT server. 🙂
Of course, you can also extend the code a bit so that the data is also displayed on the dashboard. You can find information about the dashboard nodes here, for example: https://nerdiy.de/de_de/nodered-mit-dashboard-nodes-eine-benutzeroberflaeche-erstellen/