HowTo: Node Red - Reading data from a SMA EV CHARGER 22 wallbox

An SMA EV Charger 22 wallbox has recently been added to my network. This is of course primarily used to charge an electric car.

Nevertheless, I was of course curious about which values could be read out and further processed there.

The Node Red code presented below is my current status. This can be used to read out the most common consumption and producer data. This means you can access individual values of the power network as well as the connected car.

Further information is summarized in this article.


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:
To be able to 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.

In the following lists you will find all the parts you need to implement this article.

Required tool:

NumberLink
1xScrewdriver set  Buy at Amazon
1xSD card reader  Buy at Amazon

Required material:

NumberLink
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
1xSMA EV CHARGER 22 Wallbox


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.

To use the node code linked below with your ESPEasy device, you need to make a few changes. These are described in the next section.

You can find the Node Red code in the Nerdiy Git repository at the following link:

In the gallery below you can see a photo of the view of the flow in the configuration view. As you can see, I was already able to assign/read most of the values. However, for some (less important in my opinion) the correct assignment is still missing. If you've figured this out, please leave me a comment.

Another view of the Node Red Flow in the configuration interface.

In order for the Node Red Flow to work correctly, you must set the access data of 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 further process the recorded data.


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

Buy Me a Coffee at ko-fi.com       

15 comments

  1. Hello,
    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.

  2. Hello,

    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?

    1. Hey Toby,
      Just to rule that out (sorry for the potentially stupid question) you entered the access data to your MQTT server into the “distribute_wallbox_data” node, right? Not the login details for the wallbox. 🙂
      Best regards
      Fabian

  3. Hi,
    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.

    Greetings,
    novel

    1. Hi Roman,
      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 were to take place (which, as I said, is very difficult for me to imagine because it simply doesn't make sense from a technical point of view or is even unwise) it is actually now standard for the manufacturer to take 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. :/
      Best regards
      Fabian

      1. Hello Fab,
        Thank you for your detailed reply. Wear leveling didn't tell me anything at all. Learned something again.

        Best regards
        novel

  4. 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?

    1. Hi Toby,
      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 may not be installed. This is necessary to retrieve the data. Can you test whether curl is installed by, for example, entering “curl -I google.de” into the terminal of your HomeAssitant? (The command simply retrieves the header from google.de and gives you the information).
      Best regards
      Fabian

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

  6. Hello Fabian,
    I get the status “connected” under “distribute_wallbox_data” but the dashboard doesn’t output any values. What could it be?
    Greetings Mark

    1. Hi Mark,
      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/
      Best regards
      Fabian

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert

This site uses Akismet to reduce spam. Learn how your comment data is processed.