Help Required Uploading Growatt Inverter To PVOutput

I would love to see the Modbus spec he used. First I noticed he is reading the first 100 registers in a single read. The documentation we have explicit says inverter will not answer to that, for sure newer models have upgraded spec. He also removed the upper nibble calculation from power, not big deal since most small to medium installs will never reach such a high power. He sure have two arrays because he sums the voltage of vpv1 and vpv2, I did not care for a second array. He takes the inverter temperature from register 97, our documentation says this register is Grid Fault Record 2 (daily | hour)

So, clearly, the modbus spec went through revision for those newer models.

No I don’t believe it does, here is a manual for it: http://www.ginverter.com/upload/file/contents/2019/08/5d5b6afb90a56.pdf

And here is a picture of mine:

Not sure how to connect the inverter to the RPi w/o an interface port? :thinking:

According to the manual there is a com port (L page7 of the manual).
In your case this port seems to be occupied with the blue cable. Is this cable connected anywere?

It goes to my switchboard to a “SDM230-Modbus” meter.

@highon2str
Then you are probably able to connect a cable attached to an RS485 to usb (costs about 3 euro plus the cost of the cable like the blue one) to the modbus meter (where the blue cable is connected) and get both the data from the inverter and the meter using a pc or a raspi or even a cheap orangepi zero (with armbian). Is this bidirectional meter used for the inverter only or also for the grid energy?
You will need to adjust the modbus parameters of the meter if the installer has not done it already (i.e. Modbus ID: 2 if the inverter has id:1, Baud rate 9600, Parity: NONE, Stop bits:1). All these parameters needs to be the same on both the inverter and the meter except the id.

Edit: you can even use your router to get the data if it has usb, it is using Openwrt and you are able to use ssh
Edit2: Ask your installer for the current use of the meter before changing any parameters. Though as the connection is done by the installer the parameters are probably adjusted already.

Agreed

Same model a friend’s parent had installed recently.

As per manual, your blue cable might be connect to pins 2, 7 and 8 of the eastron SDM230. And your monitor software (aka RPi) shall be connected to pins 2, 3 and 4 (page 34 item 7.4). If those pins are going to some other place, let us know also.

You will need a rs485 to USB adapter as @lampra mentioned. I had success using those:

https://bit.ly/2WquKOo -> very simple, look and feel very cheap but worked on my ABB Uno for debug purposes and also on a Eastron SMD630a. Does not require ground (pin 2 on the diagram page 34 of your manual).

https://bit.ly/3nH10Jf -> while bare open it has (it least it say it has) TVS protection that is a bonus for areas with high lighting activity (where I lived in Brazil). You need a USB cable (USBA -> usbB connector, common on printers). This is the one I most used.

https://bit.ly/3mrdq6f -> just for the records, those also works really well. Although I used them connected to arduino/esp8266 boards, they can theoretically be connected to serial port of an RPi. But is too much external components to take care if you have the USB ports on an RPi. Go for the USB.

BRs

Hello, I decided using a Raspberry Pi with Raspbian.
1 - I run the following commands:
1.1 - #sudo apt update
1.2 - #sudo apt upgrade
1.3 - #sudo apt install bc jq
2 - I installed the following API Client: GitHub - Sjord/growatt_api_client: This Python script logs in to server.growatt.com and retrieves data on solar panels. following the steps informed on the page.
3 - In the API directory itself, I created the pvoutput.sh script with the following content:
#!/bin/bash

#Log on Growatt Server using your login and password (change on next line)
PROGRAMA=$(python -m growatt 'LOGIN' 'PASSWORD')
echo $PROGRAMA > saida.txt
sed "s/u'/'/g" saida.txt > saida1.txt
sed "s/\[//g" saida1.txt > saida2.txt
sed "s/\]//g" saida2.txt > saida3.txt
sed "s/'/\"/g" saida3.txt > saida4.txt
sed "s/True/\"true\"/g" saida4.txt > saida5.txt
sed "s/False/\"false\"/g" saida5.txt > saida6.txt
cat saida6.txt | jq --compact-output '.data.currentPower' > saida7.txt
sed -i "2d" saida7.txt 
sed "s/\"//g" saida7.txt > saida8.txt
sed "s/ /|/g" saida8.txt > saida9.txt
GERANDO=$(cat saida9.txt)
IFS='|'
read -a SPLITADO <<< "$GERANDO"
if [ "${SPLITADO[1]}" = "kW" ];
then
        POTENCIA=`echo "${SPLITADO[0]}*1000" | bc`
else
        POTENCIA="${SPLITADO[0]}"
fi
IFS='.'
read -a POTENCIAARRAY <<< "$POTENCIA"
POTENCIAOK="${POTENCIAARRAY[0]}"
DATA=$(date '+%Y%m%d')
HORA=$(date '+%H:%M')
#Send data to PVOutuPut using YOURAPI and SYSTEMID (change on next line)
curl -d "d=$DATA" -d "t=$HORA" -d "v2=$POTENCIAOK" -H "X-Pvoutput-Apikey: YOURAPI" -H "X-Pvoutput-SystemId: SYSTEMID" https://pvoutput.org/service/r2/addstatus.jsp

4 - I changed the crontab to run every 5 minutes:
4.1 - #crontab -e
4.2 - at the end of the file add the following line:
*/5 * * * * cd /home/pi/growatt_api_client/ && bash pvoutput.sh >/dev/null 2>&1

Okay, for me it’s working smoothly:
https://pvoutput.org/intraday.jsp?id=73728&sid=73092&dt=20210302

saida.txt → Portuguese speaker spotted

1 Like

Hello there!

I’ve been reading many times this thread the last couple of weeks, so much info! I have a Growatt SPF5000ES that uses another version of registers (v0.11 / 2017-8-09), so I’m trying to adapt codes to my particular case. This inverter has an USB type B to which I connected a RaspberryPi3, tried to read some registers without success (because I didn’t knew aboute the different versions). Today I was modifying the code of ZeroErrors and was able to inject some data on InfluxDB and draw it on Grafana.

My endgoal is to replace the RPi with an ESP8266 and integrate this monitoring on Home Assistant.

1 Like

Hi,

I do like a lot the code from ZeroErrors! Very organized and easy to to read. I do ingest inverter modebus using Telegraf and sending it to InfluxDB. Same end result just leveraging data collection offered by Telegraf (that I used to monitor the RPi anyway). Now I use a simple python script to query Influx and send to PVoutput. My motivation to that was the addition of a power meter to the house, so I would need to make the python code read two different RS485 buses (no way to put both in the same bus here) or two different script and a way to serve data to pvoutput together… so telegraf queries both RS485 buses and python queries influxdb to send pvoutput.

Regarding ESP8266, I thought a lot on pursuing this path, on my old ABB I had a radio based reading using Arduino (not wifi but same idea). Due to USB you might want to go something more powerful like ESP32 of some sort, deal with USB is not as easy as RS232. However, if you have no problems with RPi3 there, let it be. Too much effort just to save about 4Wh and not much money (in hardware).

I am glad this thread come so far and many people bringing a lot if cool ideas. Learning a lot together.

@lampra I did no forgot to make the modifications you asked :frowning:

pi@SolarLog:~/canadian-pvoutput $ docker build -t canadian-pvoutput .
Sending build context to Docker daemon 1.778MB
Step 1/4 : FROM python:3.8-alpine
—> 1a053abcf5a4
Step 2/4 : LABEL maintainer=“Josenivaldo Benito Jr. SvenDowideit@home.org.au
—> Using cache
—> 5878975cf54f
Step 3/4 : COPY requirements.txt .
—> Using cache
—> 386f90d163e5
Step 4/4 : RUN pip install --no-cache-dir -r requirements.txt
—> Running in 82e53a5f298e
Fatal Python error: pyinit_main: can’t initialize time
Python runtime state: core initialized
PermissionError: [Errno 1] Operation not permitted
Current thread 0xb6fbf390 (most recent call first):
no Python frame
The command ‘/bin/sh -c pip install --no-cache-dir -r requirements.txt’ returned a non-zero code: 1
pi@SolarLog:~/canadian-pvoutput $

Hi Mate, I fell into this hole while trying to build the docker container, and have not been able to resolve, can you please give me a tip on what the issue could be?

Thanks in advance.

Hi @cressie ,

Are you using latest commit in the master branch? I just did:

Successfully built 2bbd206a1dc7
Successfully tagged canadian-pvoutput:latest

Another question: where are you trying to build it? Does your user have permission to run docker? Otherwise, try it with sudo.

If you trust me, I just build it and pushed to docker registry under jrbenito/canadian-pvoutput. I say “if you trust me” because you have no easy way to audit what one puts into his own images, so you have to trust the source.

Let me know if you are able to advance.

1 Like

docker push jrbenito/canadian-pvoutput
Using default tag: latest
The push refers to repository [docker.io/jrbenito/canadian-pvoutput]
76d4874023e0: Pushed
3ff3caaab9b3: Pushed
c138b27e867b: Mounted from library/python
11d19a761ef7: Mounted from library/python
01534b568332: Mounted from library/python
267a6a0302bf: Mounted from library/python
b2d5eeeaba3a: Mounted from jrbenito/influx2pvoutput
latest: digest: sha256:8abbc64307913db72977241caf99f3876bab1e462aa1afba9dc5f6608f37f33c size: 1786

push log if interesting to anyone

1 Like

pi@SolarLog:~ $ sudo docker run --restart always --name=“pvoutput” -d -i --device=/dev/ttyUSB0 --net=host -v /home/jrbenito/canadian-pvoutput:/app -w /app jrbenito/canadian-pvoutput ./pvoutput.sh .
docker: Error response from daemon: Conflict. The container name “/pvoutput” is already in use by container “9d49ccd683a9716562f1154bc41634d5754aa35ec16388737417ffea52c42684”. You have to remove (or rename) that container to be able to reuse that name.
See ‘docker run --help’.

Thanks for your help, I was able to pull your docker container and attempt to run it. and get the above output…

pi@SolarLog:~ $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
pi@SolarLog:~ $ ^C
pi@SolarLog:~ $ docker ps -all
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dcd53a45b733 jrbenito/canadian-pvoutput “./pvoutput.sh” 47 minutes ago Created pensive_tereshkova

I run the above showing it is “created” but not running, so I am unsure what I have done wrong, or what to do from here to “run” the container and its contents.

also, a follow up question: would I need to open the container and edit pvoutput.txt to add my system details etc? before running it? if so…how on stock raspbian?

Thanks in advance for any help, I don’t do this that often, so can get turned around in linux based systems quite easily :frowning:

Quick update:

I have it working outside of the container. Unsure why the docker bit will not work but at this stage I will just leave it as is. I have put the shell script in the crontab file so it starts up on reboot and in the background. will check to make sure its uploading in the morning when the life giver returns.

Thanks for your help JR.

Ok, so you have a container named pvoutput and, you have a container called pensive_tereshkova. Docker cannot run containers with same name. If they are not running you can delete them with docker rm pvoutput and docker rm tereshkova and try run it again.

Clarifying:

A named container can be restarted with same parameter at any time, so for instance:

docker run -name test-named -v /some/place:/some/other-place -v /dev/ttyUSB0:/dev/ttyUB0 jrbenito/pvouput

will create a container named test-named based of on image jrbenito/pvoutput that contains two volume mounts (including a device ttyUSB0). Imagine you reboot your system and want to run it again, you just need:

docker start test-named
(to stop it, use stop instead of start)

This way, all configurations are preserved. However, if you do not name your container:

docker run -v /some/place:/some/other-place -v /dev/ttyUSB0:/dev/ttyUB0 jrbenito/pvouput

Docker will create a random name for you, next time you need to run the entire command again to create another container (or do docker ps -a and find the random name created by docker to use with start command).

Finally, if you try to configure a named container:

docker run -name test-named -v /some/place/new:/some/other-place/new -v /dev/ttyUSB0:/dev/ttyUB0 jrbenito/pvouput
(I changed the -v parameter)
docker will complain that a container named test-named already exist, so, for this to work, you first need to remove it with docker rm test-named.

BRs,
José

1 Like

Hi All,

Is this software still working by any chance.? I have just installed a Growatt SPH6000 Hybrid Inverter.

Thanks in advance.

Yes still working for me.

Bob.

Thanks, @bobboulby. Is your instructions still up to date. The inverter I have is the SPH6000 its has a RS232 port but currently occupied by the Shinewifi dongle.Is there anyway I can get this to work using the USB port, sorry if this has already been answered , I ll reread the thread to see if I missed anything.

Kind Regards

My instructions in post #154 should still work as far as I know although I suppose that this depends on whether your newer inverter still presents the data in the same format. I think you will have to use the RS232 port and remove the Growatt dongle.

Good luck, let us know how you get on.