borft / py-goodwe Goto Github PK
View Code? Open in Web Editor NEWPython lib to query Goodwe inverters
License: GNU General Public License v3.0
Python lib to query Goodwe inverters
License: GNU General Public License v3.0
Bedankt voor dit handige stukje code!
Ik krijg helaas bij het uitvoeren van de code een foutmelding(begin gaat wel goed en data wordt uit de GoodWe gehaald):
Traceback (most recent call last): File "run.py", line 88, in <module> cur.execute(query, values) psycopg2.errors.SyntaxError: syntax error at or near "ON" LINE 1: ....5,6553.5,148,49.97,655.35,655.35,4.3,1.1,1281.5) ON CONFLIC...
Ik maak gebruik van een oude Synology NAS, waardoor ik alleen psycopg2-binary kan installeren. Dus wellicht dat mijn foutmelding daar mee te maken heeft. Heb je een idee hoe ik dit zou kunnen oplossen?
Hello, I have a problem and wanted to check if there is any idea to proceed.
I have GoodWe inverter HF_E20, with LAN module (not wifi). PV master app from mobile phone works (wifi bridged to the same network), inverter also sends data to semsportal.
When I try the first phase manually using netcat, I succeed:
$ nc -u 192.168.42.150 48899
WIFIKIT-214028-READ
192.168.42.150,34:ea:e7:98:25:96,HF_E20
However, when trying with py-goodwe, I am not getting any response.
$ python3 run.py
Retrying 2 timed out
Retrying 1 timed out
Retrying 0 timed out
failed: Could not get proper data after retrying
I have in config.ini
[goodwe]
ip =192.168.42.150
port = 8899
I think the inverter doesn't react to the message \x7f\x03\x75\x94\x00\x49\xd5\xc2. I've tried to put there a test msg \xAA\x55\xC0\x7F\x01\x02\x00\x02\x41 instead, which has produced some response apparently, as the message changed to
Retrying 1 Invalid data (unexpected length: 85
I've tried to send these two manually as well:
$ echo -e "\x7f\x03\x75\x94\x00\x49\xd5\xc2" | nc -u 192.168.42.150 8899
(no response)
$ echo -e -n "\xAA\x55\xC0\x7F\x01\x02\x00\x02\x41" | nc -u 192.168.42.150 8899
�U��L0707CGW10K-ET 9010KETU21BW442302041-19-S0C�
So the communication works and probably just the default command to get data is not working for this type.
More info - I have scanned the inverted with nmap, I can see I have opened TCP 80 and 502 and UPD 8899 and 48899. When tried to discover more about modbus on TCP502, I didn't get anything more detailed.
$ nmap -sU -p0-65535 192.168.42.150
Starting Nmap 7.80 ( https://nmap.org ) at 2022-10-18 19:16 CEST
Stats: 0:02:00 elapsed; 0 hosts completed (1 up), 1 undergoing UDP Scan
UDP Scan Timing: About 3.89% done; ETC: 20:08 (0:49:26 remaining)
Nmap scan report for 192.168.42.150
Host is up (0.0013s latency).
Not shown: 65534 closed ports
PORT STATE SERVICE
8899/udp open|filtered ospf-lite
48899/udp open|filtered unknown
MAC Address: 34:EA:E7:98:25:96 (Shanghai High-Flying Electronics Technology)
Nmap done: 1 IP address (1 host up) scanned in 3293.26 seconds
$ nmap -sT -p0-65535 192.168.42.150
Starting Nmap 7.80 ( https://nmap.org ) at 2022-10-20 13:47 CEST
Nmap scan report for 192.168.42.150
Host is up (0.037s latency).
Not shown: 65534 closed ports
PORT STATE SERVICE
80/tcp open http
502/tcp open mbap
MAC Address: 34:EA:E7:98:25:96 (Shanghai High-Flying Electronics Technology)
Nmap done: 1 IP address (1 host up) scanned in 129.75 seconds
$ nmap --script modbus-discover -p 502 192.168.42.150
Starting Nmap 7.80 ( https://nmap.org ) at 2022-10-22 14:12 CEST
Nmap scan report for 192.168.42.150
Host is up (0.0012s latency).
PORT STATE SERVICE
502/tcp open mbap
MAC Address: 34:EA:E7:98:25:96 (Shanghai High-Flying Electronics Technology)
Nmap done: 1 IP address (1 host up) scanned in 688.56 seconds
Any hint what/how to change, please?
Thank you,
jimo4242
Hey!
Thanks for this great tool, I will try it out as soon as my PV goes online. But do you mind adding support for InfluxDB?
When you don't want to add it, i will read into your code and try to implement it on my own, but I got little free time atm.
So it could take a while :)
Because for ppl which use InfluxDB and Grafana we can keep our setup as minimal as possible.
I will happily contribute a Grafana Dashboard, as soon as i can try it out. :)
Error im receiving:
Traceback (most recent call last):
File "Solar_MQTT2.py", line 1, in <module>
from goodwe import Goodwe,GoodweStatus
File "/home/pi/goodwe.py", line 14
def to_16_bit(buffer: [bytes], exp: int = -1, signed: bool = False) -> int:
^
SyntaxError: invalid syntax[](URL)
script:
from goodwe import Goodwe,GoodweStatus
import paho.mqtt.client as mqtt
from random import randrange, uniform
import time
from datetime import datetime
import sys
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
ip = "192.168.68.141"
gw = Goodwe(ip=ip)
mqttBroker ="192.168.68.119"
client = mqtt.Client("SolarRoof2")
client.connect(mqttBroker)
print('booting...')
while True:
current_time = now.strftime("%H:%M:%S")
#print(current_time)
if current_time > '06:00:00':
if current_time < '19:00:00':
client.connect(mqttBroker)
try:
data = gw.getData()
except Exception as e:
print("Failed: ".format(e))
time.sleep(300)
exit(0)
data['power_dc_1'] = round(data['power_dc_1'], 2)
data['power_dc_2'] = round(data['power_dc_2'], 2)
client.publish('yield_today2', data['yield_today'])
power = round(data['power_dc_2']+data['power_dc_1'], 2)
client.publish('power2', power)
print('publisch to yield_today2', data['yield_today'])
print('publisch to power2', power)
print('data succesfully recived and send')
time.sleep(30)
else:
print('out of time cheking again in 60sec')
time.sleep(60)
else:
print('out of time cheking again in 60sec')
time.sleep(60)
python version:
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.