Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (25 sloc) 1.97 KB


A node-red flow to transfer from Sparsnas mqtt script to influxdb

This uses the mqtt script from @tubalainen found here and splits up the json string to each value and puts it in a influxdb database.

Things you need

  • Lots of things, look at the link above to get the mqtt interface working.
  • A node-red installation
  • A influxdb database


  1. Create a new Database in your influxdb install named sparsnas (or name it something else but remember it for later or just skip it, I like to keep them separated)
  2. Import the node-red flow and it should look something like this: node red flow
  3. In the mqtt in node replace the server IP with your MQTT server and use the correct Topic if you changed it.
  4. In each of the functions replace the IP adress in "" with the correct adress to your influxdb adress (This is also where you need to change the db name if you didn't follow my suggestion in 1.)
  5. That's it. Now it should start to populate your database with the values from your Sparsnäs energy meter.


So why would you want to go through with this... well because you can make all sorts of fun stuff in graphana with the data. The functions in the node red flow looks like this:

msg.url ="";
msg.payload = "sparsnas" + ",measurement=Watt " + " value=" + msg.payload.Watt;
return msg;

First row is just the http post adress for the influxdb with the targeted database

The second row sets the payload to be the sparsnas measurement, adds a tag that's the name of measurement (ie. Watt, kWh, Battery or FreqErr) followed atlast by the value. That way even if you don't use a separate DB you won't get them mixed up with other values and you can easily select what measurements you want to show like this: graphana image

You can’t perform that action at this time.