sdsolomo / growatt-x000ES

24 stars 9 forks source link

Exception while running the code #1

Open anomajaya opened 2 years ago

anomajaya commented 2 years ago

Hi,

Thank you for the code. I'm running this on Pi4 type B on Ubuntu 21.10. I'm trying to connect my Growatt 5000 EC inverter. Once execute the code the following error occurs.

pi@pi-Ubuntu:~/growatt-x000ES$ python3 getconfig.py
Establishing connection to Influx..Done!
Creating Influx Database  growattconfig  ..Done!
Connecting to Inverter..Done!
Loading inverters.. Name  Growatt1  unit is  1  measurement is  config1
Traceback (most recent call last):
  File "/home/pi/growatt-x000ES/getconfig.py", line 151, in <module>
    growatt = Growatt(client, name, unit)
  File "/home/pi/growatt-x000ES/getconfig.py", line 43, in __init__
    row = self.client.read_holding_registers(73, unit=self.unit)
  File "/usr/local/lib/python3.9/dist-packages/pymodbus/client/common.py", line 114, in read_holding_registers
    return self.execute(request)
  File "/usr/local/lib/python3.9/dist-packages/pymodbus/client/sync.py", line 108, in execute
    raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusSerialClient(rtu baud[9600])]
pi@pi-Ubuntu:~/growatt-x000ES$ 

could you please look into it and let me know what would be the reason? And I'm not an expert on Python. In my Pi USB is connected to /dev/ttyUSB0

Thanks a heap!

sdsolomo commented 2 years ago

Hi, From the error, it is unable to communicate with your inverter. " pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusSerialClient(rtu baud[9600])]"

I would double-check your wiring and probably try another usb cable. you should see the inverter showing up when you do an "lsusb" from the pi.

s

On Sat, Apr 23, 2022 at 11:49 PM Anoma Jayaratne @.***> wrote:

Hi,

Thank you for the code. I'm running this on Pi4 type B on Ubuntu 21.10. I'm trying to connect my Growatt 5000 EC inverter. Once execute the code the following error occurs.

@.:/growatt-x000ES$ python3 getconfig.py Establishing connection to Influx..Done! Creating Influx Database growattconfig ..Done! Connecting to Inverter..Done! Loading inverters.. Name Growatt1 unit is 1 measurement is config1 Traceback (most recent call last): File "/home/pi/growatt-x000ES/getconfig.py", line 151, in growatt = Growatt(client, name, unit) File "/home/pi/growatt-x000ES/getconfig.py", line 43, in init row = self.client.read_holding_registers(73, unit=self.unit) File "/usr/local/lib/python3.9/dist-packages/pymodbus/client/common.py", line 114, in read_holding_registers return self.execute(request) File "/usr/local/lib/python3.9/dist-packages/pymodbus/client/sync.py", line 108, in execute raise ConnectionException("Failed to connect[%s]" % (self.str())) pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusSerialClient(rtu baud[9600])] @.:/growatt-x000ES$

could you please look into it and let me know what would be the reason?

Thanks a heap!

— Reply to this email directly, view it on GitHub https://github.com/sdsolomo/growatt-x000ES/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOWUJYZ3G5BCGBOPWVR72DVGTAGDANCNFSM5UFUCWJA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

anomajaya commented 2 years ago

Thank you. Yes, you are correct. Once I changed the cable it worked. And now I have tested it in my Pi4 with Raspberry OS and with Ubuntu 21.10 as well. Works well in both.

sdsolomo commented 2 years ago

Awesome, thanks! S

On Fri, Apr 29, 2022, 12:48 AM Anoma Jayaratne @.***> wrote:

Thank you. Yes, you are correct. Once I changed the cable it worked. And now I have tested it in my Pi4 with Raspberry OS and with Ubuntu 21.10 as well. Works well in both.

— Reply to this email directly, view it on GitHub https://github.com/sdsolomo/growatt-x000ES/issues/1#issuecomment-1112898112, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHOWUJ3ECKPREOM4BRDCCRDVHNZ2NANCNFSM5UFUCWJA . You are receiving this because you commented.Message ID: @.***>

ochayi commented 1 year ago

Hello, I am unable to get it to work on my pi3.

I successfully got to the point where I ran the code "python3 getconfig.py" It returned the message "python3: can't open file '/home/pi/getconfig.py': [Errno 2] No such file or directory"

I can't figure out where I got it wrong. Please point me to where I went wrong and how to fix it.

Thanks.

doglan commented 1 year ago

Hi @sdsolomo, hope you can help me with this problem. I have a pi with your software installed and I am getting the same error as @anomajaya.

dietpi@rpi1:~/growatt-x000ES-main$ python3 getconfig.py
Establishing connection to Influx..Done!
Creating Influx Database  growattconfig  ..Done!
Connecting to Inverter..Done!
Loading inverters.. Name  Growatt1  unit is  1  measurement is  config1
Traceback (most recent call last):
  File "/home/dietpi/growatt-x000ES-main/getconfig.py", line 152, in <module>
    growatt = Growatt(client, name, unit)
  File "/home/dietpi/growatt-x000ES-main/getconfig.py", line 44, in __init__
    row = self.client.read_holding_registers(73, unit=self.unit)
  File "/home/dietpi/.local/lib/python3.9/site-packages/pymodbus/client/common.py", line 114, in read_holding_registers
    return self.execute(request)
  File "/home/dietpi/.local/lib/python3.9/site-packages/pymodbus/client/sync.py", line 107, in execute
    raise ConnectionException("Failed to connect[%s]" % (self.__str__()))
pymodbus.exceptions.ConnectionException: Modbus Error: [Connection] Failed to connect[ModbusSerialClient(rtu baud[9600])]

I checked the USB connections and the inverter (spf-5000) is listed:

dietpi@rpi1:~/growatt-x000ES-main$ lsusb
Bus 001 Device 008: ID 04e2:1410 Exar Corp. XR21V1410 USB-UART IC
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 003: ID 0424:ec00 Microchip Technology, Inc. (formerly SMSC) SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Microchip Technology, Inc. (formerly SMSC) SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

It gets listed as /dev/ttyACM0.

And here are some lines from dmesg:

[   75.701120] usb 1-1.3: new full-speed USB device number 8 using dwc_otg
[   75.843880] usb 1-1.3: New USB device found, idVendor=04e2, idProduct=1410, bcdDevice= 0.03
[   75.843940] usb 1-1.3: New USB device strings: Mfr=0, Product=0, SerialNumber=0

I tried a couple of cables with the same result.

Any ideas? Thanks a lot!