Jump to content

Sunsynk5.5 Simple Local Data Monitoring (No Cloud/Internet Needed) Setup Guide Step 1 (The Software)


Recommended Posts

Posted (edited)

For my Sunsynk5.5 Simple Local Monitoring and Graphing Solution I use a single RPi4 2gig + 1 terabyte external HDD + Official RPi4 Power-supply.
The comms between my RPi4 and the Sunsynk 5.5 inverter is done using the Sunsynk BMS RS485 port wired to a standard (RS485 to RS232 Converter) and then to a standard (RS232 to USB converter).
This comms setup gave me the most stable and fastest/reliable way to get the data from the Sunsynk.
You can still use your Solarman or Sunsynk dongle at the same time.

Credits
Shout out again to @Bloubul7 who has an awesome post going about using nodered and Sunsynk :)
That was the foundation for setting up my own dashboard running on a different platform for simple visualisation.

Note: This guide is not for noobs, you need at least good understanding of how to use a raspberry pi and install and run stuff on it from the command line.

After you have completed this setup guide, both Step 1 and Step 2, you will/should end up with a good starting point for Your Own Customisable Data Dashboard for your Sunsynk.


install-1-sunsynk5-5-local-monitoring-no-cloud-needed.thumb.jpg.2fb1261ed73222ca539455be096ebdf8.jpg

install-2-sunsynk5-5-local-monitoring-no-cloud-needed.thumb.jpg.f4c1b936468e8c3cff04859bbc2579df.jpg

 

STEP 1

Assumptions
You already know how to install headless OS (RASPBERRY PI OS LITE (Legacy) Buster Lite works best) on your RPi4
You already know how to make sure you have configured your RPi4 so you can access the RPi4 using your wifi/ethernet and putty shell.
If the above has you confused then this guide may not be for you.

Ok, let's dive right in.

Do a fresh Install Of RASPBERRY PI OS LITE (Legacy) Buster

Now for the fun stuff.

Do not try taking shortcuts, do each line of command on its own one by one in the order posted below :)

Start with the following commands on your RPi4 shell.

sudo apt update
sudo apt upgrade
sudo apt -y install build-essential git nano wget

Easy, that's the basic essentials out the way.
Now do the following:

sudo apt install openjdk-11-jdk

Now check to see that it installed correctly:

java -version

That should give you an output similar to this:
openjdk version "11.0.xx"
OpenJDK Runtime Environment (...)
OpenJDK 64-Bit Server VM (build ...)

Next we download thingsboard:

wget https://github.com/thingsboard/thingsboard/releases/download/v3.3.4.1/thingsboard-3.3.4.1.deb

Now we install thingsboard:

sudo dpkg -i thingsboard-3.3.4.1.deb

That was sooo easy :)

Next we install the database system to store all the data and run thingsboard on:
# import the repository signing key:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

Now add the repository contents to your system:

RELEASE=$(lsb_release -cs)
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}"-pgdg main | sudo tee  /etc/apt/sources.list.d/pgdg.list

Now install and launch the postgresql service:

sudo apt update
sudo apt -y install postgresql
sudo service postgresql start

Once PostgreSQL is installed you may want to create a new user or set the password for the the main user.
The instructions below will help to set the password for main postgresql user:

sudo su - postgres
psql
\password
\q

Then, press “Ctrl+D” to return to main user console and connect to the database to create thingsboard DB:

psql -U postgres -d postgres -h 127.0.0.1 -W
CREATE DATABASE thingsboard;
\q

Now type the following command to get back to your root:

exit

Now we can configure thingsboard:

sudo nano /etc/thingsboard/conf/thingsboard.conf

Add the following lines to the the bottom of the configuration file.
Don’t forget to replace “PUT_YOUR_POSTGRESQL_PASSWORD_HERE” with your real postgres user password you created earlier.
Here you can copy all the code in one go and paste to the configuration file:

# DB Configuration 
export DATABASE_TS_TYPE=sql
export SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect
export SPRING_DRIVER_CLASS_NAME=org.postgresql.Driver
export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/thingsboard
export SPRING_DATASOURCE_USERNAME=postgres
export SPRING_DATASOURCE_PASSWORD=PUT_YOUR_POSTGRESQL_PASSWORD_HERE
# Specify partitioning size for timestamp key-value storage. Allowed values: DAYS, MONTHS, YEARS, INDEFINITE.
export SQL_POSTGRES_TS_KV_PARTITIONING=MONTHS
# Update ThingsBoard memory usage and restrict it to 256MB in /etc/thingsboard/conf/thingsboard.conf
export JAVA_OPTS="$JAVA_OPTS -Xms256M -Xmx256M"

Ctrl x then choose yes to save the settings you pasted.

Once ThingsBoard service is installed and DB configuration is updated, you can now execute the following script:
# --loadDemo option will load demo data: users, devices, assets, rules, widgets.

sudo /usr/share/thingsboard/bin/install/install.sh --loadDemo

Execute the following command to start ThingsBoard:

sudo service thingsboard start

Perfecto, This is so easy up till now :)

Now let's move on to installing Nodered the easy and correct way.
Do not try cheating and using nodered install via raspberry, this way is the better way.

To Easily Install nodered run the following:

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)

NOTE: The script will ask you a couple of questions about whether you are sure you want to proceed, and whether to install Pi-specific nodes. Say “y” (yes) to both questions.

Node-RED can be extended by installing modules to give it extra features that we will need.
We need to do that now so that it can be ready for the flows we will be using later.
Some of these may already be installed, install all anyway one by one.
If you are prompted that it already exists simply continue to the next.
Use NPM to install the following nodes one at a time:

npm install node-red-contrib-batcher
npm install node-red-contrib-buffer-parser
npm install node-red-contrib-cycle
npm install node-red-contrib-hcl-iterate-loop
npm install node-red-contrib-influxdb
npm install node-red-contrib-modbus
npm install node-red-contrib-moment
npm install node-red-contrib-play-audio
npm install node-red-contrib-queue-gate
npm install node-red-contrib-simple-gate
npm install node-red-node-openweathermap
npm install node-red-node-pi-gpio
npm install node-red-node-ping
npm install node-red-node-random
npm install node-red-node-serialport
npm install node-red-node-smooth

Great another job well done :)
At this point Node-RED is installed, but you still need to configure it to be automatically started on boot:

sudo systemctl enable nodered.service

You can start the service manually this time, but in future it will happen automatically when your Pi starts up:

sudo systemctl start nodered.service

By now everything should be ready and waiting for you to start using :)
You will/should now be able to open the thingsboard Web UI on your pc/laptop using the following link (Replace With Your Network IP for Your RPi):

http://YOURPILOCALIPADDRESS:8080/
Default admin login info:
System Administrator username: [email protected]
System Administrator password: sysadmin

You will/should now also be able to open the nodered Web UI on your pc/laptop using the following link (Replace With Your Network IP for Your RPi):

http://YOURPILOCALIPADDRESS:1880

If you do not know what the network IP is then use the following command on your Pi:

ifconfig

That should show similar to this.
pi@yourpihostname:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.253  netmask 255.255.255.0  broadcast 192.168.120.255  - THE PART IN BOLD SHOULD BE WHERE YOUR IP SHOWS
        inet6 fe80::b44e:b3e5:8e66:fd02  prefixlen 64  scopeid 0x20<link>
        ether dc:a6:32:33:a2:82  txqueuelen 1000  (Ethernet)
        RX packets 26208  bytes 5851724 (5.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 17944  bytes 4846864 (4.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 451007  bytes 74785599 (71.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 451007  bytes 74785599 (71.3 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.5  netmask 255.255.255.0  broadcast 192.168.130.255  - THE PART IN BOLD SHOULD BE WHERE YOUR IP SHOWS
        inet6 fe80::966a:72cb:c7d4:c3c2  prefixlen 64  scopeid 0x20<link>
        ether dc:a6:32:33:a2:84  txqueuelen 1000  (Ethernet)
        RX packets 13381  bytes 4282322 (4.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 193  bytes 29382 (28.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Coming Soon....
Setup Guide Step 2 (Adding Nodered Flows and Setting Up Your 1st Dashboard)

Edited by WannabeSolarSparky
spelling
Posted

I am posting Step 2 of the guide this evening, but if you cannot wait and want to figure it out yourself here are the required files needed for thingsboard and nodered :)

flows.json is for nodered the other 2 are for thingsboard one is a copy of my demo dashboard and the second is a copy of my eskom loadshedding cards.

thingsboard_loadshedding_cards.json flows.json sunsynk_1_local.json

Posted

Awesome, looking forward to the next steps.  I am a total NOOB at this so have a lot of practice and learning to do ahead of me.

I have a question.  I assume each time the data is captured from the inverter it is like a snap shot of all the parameters at that moment.  (every few seconds?).  How exactly are the accumulated figures calculated? The delta between each snap shot value added together?


 

Posted
18 minutes ago, Halcyon said:

Awesome, looking forward to the next steps.  I am a total NOOB at this so have a lot of practice and learning to do ahead of me.

I have a question.  I assume each time the data is captured from the inverter it is like a snap shot of all the parameters at that moment.  (every few seconds?).  How exactly are the accumulated figures calculated? The delta between each snap shot value added together?


 

With this particular setup each reading of each data point is done individually on a cycle and sent one by one to the dashboard/database with the timestamp set at the receiving end.
So effectively each data point has its own timestamp set as it enters the dashboard database.
As this is all done on a single device the data is stored in real time as it comes in, in total all the real-time readings are completed in a round-trip of about 23 seconds.
So all data displayed and available for manipulation is updated in 23 seconds at under 1 second per data point updated.

On the dashboard side the displayed accumulated data can be manipulated to smooth out the data to your requirements regarding date time frequency etc.
 

Posted

Apologies, this might be a stupid question.  Am I correct in saying that with this local setup you can only view the dashboard and log while on your home network?

Posted
1 hour ago, Halcyon said:

Apologies, this might be a stupid question.  Am I correct in saying that with this local setup you can only view the dashboard and log while on your home network?

Hi there, yes, this will run on your local network and will not need the internet unless you want to monitor loadshedding and weather.

  • 4 months later...
Posted

This is really awesome! I haven't tinkered with Raspberry Pi yet... I guess that will be my first start. I want to run Home Assistant as well but I'm totally in love with your dashboard! 

 

On 2022/04/21 at 9:26 AM, WannabeSolarSparky said:

Hi there, yes, this will run on your local network and will not need the internet unless you want to monitor loadshedding and weather.

So in order to check on the dashboard from another location, you'd either have to set up a web server on your RPi or set up thingsBoard on the cloud and push the data from the inverter to there? 

Posted
1 hour ago, MKRandburg said:

This is really awesome! I haven't tinkered with Raspberry Pi yet... I guess that will be my first start. I want to run Home Assistant as well but I'm totally in love with your dashboard! 

 

So in order to check on the dashboard from another location, you'd either have to set up a web server on your RPi or set up thingsBoard on the cloud and push the data from the inverter to there? 

You should be able to setup port forwarding to your local connection, thingsboard is already a webserver so that could be an option.
Else a small cheap VPS server at a local hosting provider would do the trick. Thats what I have, a local install and one on a VPS and the data gets sent to both at the same time.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...