WannabeSolarSparky Posted April 19, 2022 Posted April 19, 2022 (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. 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 April 19, 2022 by WannabeSolarSparky spelling iiznh, Scubadude, werner.potgieter and 3 others 3 3 Quote
WannabeSolarSparky Posted April 20, 2022 Author Posted April 20, 2022 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 Quote
WannabeSolarSparky Posted April 20, 2022 Author Posted April 20, 2022 Nodered data from Sunsynk no timeouts or errors sunsynk-nodered-no-timeouts.mp4 Sonoff Africa 1 Quote
Halcyon Posted April 20, 2022 Posted April 20, 2022 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? Quote
WannabeSolarSparky Posted April 20, 2022 Author Posted April 20, 2022 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. Quote
WannabeSolarSparky Posted April 20, 2022 Author Posted April 20, 2022 Real-time data updating all points updated on a 23 second cycle, one point per second. thingsboard-dashboard-real-time-data.mp4 Quote
WannabeSolarSparky Posted April 20, 2022 Author Posted April 20, 2022 Time Series Graphs in real-time, interrogate as you wish using different time settings to visualise however you like all in real-time. thingsboard-timeseries-graph-in-realtime.mp4 Quote
Halcyon Posted April 21, 2022 Posted April 21, 2022 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? Quote
WannabeSolarSparky Posted April 21, 2022 Author Posted April 21, 2022 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. Quote
Bloubul7 Posted April 21, 2022 Posted April 21, 2022 Well done, it is looking good WannabeSolarSparky 1 Quote
Janosh Posted September 21, 2022 Posted September 21, 2022 This surely looks very impressive, and enables you to monitor your system proactively. Will this system also work on a 8kW Mecer Max II. Quote
MKRandburg Posted September 26, 2022 Posted September 26, 2022 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? Quote
WannabeSolarSparky Posted September 26, 2022 Author Posted September 26, 2022 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. MKRandburg 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.