Jump to content

Connecting Axpert to Rasberry PI 4


Mark1981

Recommended Posts

Hi,

I wanted to use  a Rasberry PI 4 and connect to my Axpert VP 1K/1000W inverter for basic monitoring

My invert has the following communication ports on the side (attached pic)

Which do I need to use for monitoring? Or can I use either one?

I received a serial to ethernet cable (attached pic) with the inverter which I assume I could connect to the ethernet port and then use a serial to USB converter to connect to my Rasberry PI?

Otherwise can I use a standard printer USB cable (attached pic) to plug into the USB port and directly into the PI?

 

Thanks very much for all your help. I am very new to inverters

 

Regards,

Mark

serial_to_ethernet.jpg

usb_printer_cable.jpg

communication_ports.jpg

Link to comment
Share on other sites

Thanks very much for the reply

 

I hadn't decided yet. It's just to tinker around and do some basic monitoring so I didn't want to buy something like ICC

I read a bit about watch power but doesn't sound like I can run it on raspberry Pi

So I was looking at this

https://www.playbackdesign.com/pd-axpert/

I am definitely open to suggestions though. 

 

Link to comment
Share on other sites

Don't have any experience with pd-axpert, I've linked two projects that I've played around with before that have worked for me.

These require a little more work, I was piping the JSON data into InfluxDB and visualising it in Grafana. How are you installing pd-axpert? Maybe I can help.

 

https://github.com/manio/skymax-demo

https://github.com/lluisball/godenerg

Link to comment
Share on other sites

I am also looking at developing something myself as I am just looking for basic monitoring and not filling with any inverter settings remotely or anything like that. Then I could also send myself notifications around various states such as battery voltage.

I have worked on linux for a long time and have done a lot of bash scripting and a little bit of perl but never worked with python. From the scripts I have found on github to communicate with axpert most seem to use python but also be a lot more involved and have options for changing inverter settings.

 

Does anyone just have a basic script which communicates to the inverter and calls the QPIGS command (looks like the one I need) and outputs the data. If there was a bash script that would be awesome as I would have the knowledge to understand it and change it to add my additional functionality such as notifications. But otherwise if python is the only option I am fine with calling a python script and parsing the data in a bash script to handle my additional functionality.

Does anyone know if a basic script like this. Simply call it, it reads through USB and outputs the results from QPIGS

 

Thanks in advance

Link to comment
Share on other sites

If you just want to do it in bash, I suspect you could send the QPIGS command to the serial port using echo

not 100% sure on the syntax, but maybe something like: echo "QPIGS" > /dev/ttyUSB0

You will probably need to set things like the baud rate etc. I think a bit of googling will probably help there.

Then you could probably read the response with cat

Parsing the response is probably going to be the hardest part.

Link to comment
Share on other sites

  • 2 weeks later...
On 2020/07/24 at 12:25 PM, Stanley said:

If you just want to do it in bash, I suspect you could send the QPIGS command to the serial port using echo

not 100% sure on the syntax, but maybe something like: echo "QPIGS" > /dev/ttyUSB0

You will probably need to set things like the baud rate etc. I think a bit of googling will probably help there.

Then you could probably read the response with cat

Parsing the response is probably going to be the hardest part.

Hi Stanley. I have an inverter connect to a pi, pd axpert goes into perpetual boot cycle.

ICC i could never get it to see the inverter

Currently have solpiplog, which looks like icc, install and can't see the inverter still..

Ran the echo command and nothing happen.

Lsusb shows my 2 inverters

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

Bus 001 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

Bus 001 Device 003: ID 1997:1221

Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 

The challenge i am having no matter which program is how to connect and get the program talking to the inverters. Please help

 

Link to comment
Share on other sites

On 2020/07/24 at 1:01 PM, Theokie said:

Hi, you can try the script I made for myself to get an inverter monitor going quickly on pi.

https://github.com/BionicWeb/AxpertPi

Hi. I have tried the script. I have an axpert king on the latest firmware. Lsusb sees the 2 inverters on a usb serial.

Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

Bus 001 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

After running all the install commands i done know how to stand up the container for docker. If i use the command from nedkelly 

docker-compose up -d 

Nothing happens.

 

You to this point your instructions are clear. After the above nedkelly seems instructive but nothing happens side i am using your script not his.

I am at wits end. Do you have a similar guide for non techies? 

 

Please help.

Link to comment
Share on other sites

9 minutes ago, Lewis said:

Hi. I have tried the script. I have an axpert king on the latest firmware. Lsusb sees the 2 inverters on a usb serial.

Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

Bus 001 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

After running all the install commands i done know how to stand up the container for docker. If i use the command from nedkelly 


docker-compose up -d 

Nothing happens.

 

You to this point your instructions are clear. After the above nedkelly seems instructive but nothing happens side i am using your script not his.

I am at wits end. Do you have a similar guide for non techies? 

 

Please help.

Hi Lewis,

The containers will start by themselves, you don't need to run docker-compose.

What do you see when you run

docker ps

Should look something like this: 

pi@raspberrypi:~ $ docker ps
CONTAINER ID        IMAGE                                             COMMAND                  CREATED             STATUS                PORTS                    NAMES
75877f83e7b0        homeassistant/raspberrypi3-homeassistant:stable   "/init"                  2 days ago          Up 2 days                                      home-assistant
9eeeb6e89f7f        containrrr/watchtower                             "/watchtower --inter…"   8 days ago          Up 7 days             8080/tcp                 watchtower
c1099e1bcc4f        eclipse-mosquitto                                 "/docker-entrypoint.…"   8 days ago          Up 7 days             0.0.0.0:1883->1883/tcp   mqtt
e2907cc40d9e        bushrangers/ha-voltronic-mqtt                     "/bin/bash /opt/inve…"   8 days ago          Up 7 days (healthy)                            voltronic-mqtt

 

Edited by Theokie
Added info.
Link to comment
Share on other sites

19 minutes ago, Theokie said:

Hi Lewis,

The containers will start by themselves, you don't need to run docker-compose.

What do you see when you run


docker ps

Should look something like this: 


pi@raspberrypi:~ $ docker ps
CONTAINER ID        IMAGE                                             COMMAND                  CREATED             STATUS                PORTS                    NAMES
75877f83e7b0        homeassistant/raspberrypi3-homeassistant:stable   "/init"                  2 days ago          Up 2 days                                      home-assistant
9eeeb6e89f7f        containrrr/watchtower                             "/watchtower --inter…"   8 days ago          Up 7 days             8080/tcp                 watchtower
c1099e1bcc4f        eclipse-mosquitto                                 "/docker-entrypoint.…"   8 days ago          Up 7 days             0.0.0.0:1883->1883/tcp   mqtt
e2907cc40d9e        bushrangers/ha-voltronic-mqtt                     "/bin/bash /opt/inve…"   8 days ago          Up 7 days (healthy)                            voltronic-mqtt

 

Let me do this and revert. 

 

However the system does not seem to see my inverter connected. I will install again while the pi is already connected to the inverter. Thank you for the speedy reply. 

Link to comment
Share on other sites

2 hours ago, Lewis said:

Let me do this and revert. 

 

However the system does not seem to see my inverter connected. I will install again while the pi is already connected to the inverter. Thank you for the speedy reply. 

Redid a new installation and ssh'ed into the pi 4,  while it is already connected to only one inverter, an axpert king 5kw

1.  sudo apt update

2. sudo apt upgrade

3. Then run script from your github after the full update on a fresh install. 

curl -s https://raw.githubusercontent.com/BionicWeb/AxpertPi/master/axpertpi.sh?$(date +%s) | sudo bash

4. after above its saying: "
Resolving deltas: 100% (121/121), done.
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?"

5. Running  " sudo docker ps"
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docke                                                                                                             r daemon running?
"

6. I attach my ssh log. 

7 went to https://github.com/docker/compose/issues/6677, and executed the following to see if after reboot i can contunue

 

sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker 

8. After reboot i have run 3 again.  and then sudo docker ps. its now working.

9. Did the following and noted device was not on ttyUSB0 it was expecting direct USB. so edited that everthing elso not changed.

cd /opt/ha-inverter-mqtt-agent

# Configure the 'device=' directive (in inverter.conf) to suit for RS232 or USB.. 
sudo nano config/inverter.conf

install error.txt

Link to comment
Share on other sites

10.  went to HA ip and tried my user names and went to configuration entities and enabled all entities, 9 went up but any to do with the inverter remain marked with an x.  Pressed a botton on home screen and got "

voltronic_AC_grid_voltage
SETTINGSRELATED
This entity does not have a unique ID, therefore its settings cannot be managed from the UI."

11. Rebooted computer... and now have sensor.voltonic battery not available and may trainables in orange with exclamation mark.

 

 

Link to comment
Share on other sites

5 minutes ago, Theokie said:

Thanks Lewis, will check tomorrow and try and make a quick youtube video where I go from scratch and install on my kodak king 5kw and just make sure everything is running as it should.

Thank you good night. I then tried 

12. sudo docker exec -it voltronic-mqtt bash -c '/opt/inverter-cli/bin/inverter_poller -d -1'


[email protected]'s password:
Linux raspberrypi 5.4.51-v7l+ #1327 SMP Thu Jul 23 11:04:39 BST 2020 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Aug  3 21:56:37 2020
pi@raspberrypi:~ $ sudo docker exec -it voltronic-mqtt bash -c '/opt/inverter-cli/bin/inverter_poller -d -1'
Mon Aug  3 20:01:18 2020 INVERTER: Debug set
Mon Aug  3 20:01:18 2020 INVERTER: Current CRC: 49 C1
Mon Aug  3 20:01:18 2020 INVERTER: QMOD reply size (5 bytes)
Mon Aug  3 20:01:18 2020 INVERTER: QMOD: incorrect start/stop bytes.  Buffer: (N configuration options for the actual inverter polling process...
# This config file is for Axpert King 5KW 48V version.
# I will try and get more config options for other models.

# The device to read from...
# Use: /dev/ttyS0 if you have a serial device,
#      /dev/ttyUSB0 if a USB<>Serial,
#      /dev/hidraw0 if you're connecting via the USB port on the inverter.

device=/dev/ttyUSB0

# How many times per hour is the program going to run...
# This is used to calculate the PV & Load Watt Hours between runs...
# If unsure, leave as default - it will run every minute...

# (120 = every 30 seconds)...
run_interval=120

# This allows you to modify the amperage in case the inverter is giving an incorrect
# reading compared to measurement tools.  Normally this will remain '1'
amperage_factor=1.0

# This allows you to modify the wattage in case the inverter is giving an incorrect
# reading compared to measurement tools.  Normally this will remain '1'
watt_factor=1.01


# The following settings allow you to
Mon Aug  3 20:01:18 2020 INVERTER: Current CRC: B7 A9
Mon Aug  3 20:01:21 2020 INVERTER: QPIGS read timeout
Mon Aug  3 20:01:21 2020 INVERTER: QPIGS reply too short (7 bytes)
Mon Aug  3 20:01:21 2020 INVERTER: Current CRC: F8 54
Mon Aug  3 20:01:24 2020 INVERTER: QPIRI read timeout
Mon Aug  3 20:01:24 2020 INVERTER: QPIRI reply too short (14 bytes)
Mon Aug  3 20:01:24 2020 INVERTER: Current CRC: B4 DA
Mon Aug  3 20:01:27 2020 INVERTER: QPIWS read timeout
Mon Aug  3 20:01:27 2020 INVERTER: QPIWS reply too short (2 bytes)
^Cpi@raspberrypi:~ $ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 003: ID 1997:1221
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 

Link to comment
Share on other sites

I have just installed my rasberry PI and connected it to the Axpert inverter

lsusb seems to show the device

pi@raspberrypi:~ $ lsusb 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0665:5161 Cypress Semiconductor USB to Serial
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi:~ $

 

However there is no mapping to a usb port in /dev/ttyUSB at all. From what I understand there should be?

I found this article https://community.cypress.com/thread/30352?start=0&tstart=0 which seems to be talking about the same thing where it is being picked up as an HID device instead of a standard serial device. Mine seems to be doing the same:

From /var/log/messages

Aug  5 06:07:04 raspberrypi kernel: [    2.172735] hid-generic 0003:0665:5161.0001: hiddev96,hidraw0: USB HID v1.11 Device [HID 0665:5161] on usb-0000:01:00.0-1.3/input0

 

I was just wondering if this is a common issue and if there is a simple solution?

 

Link to comment
Share on other sites

pi@raspberrypi:/sys/class/tty $ usb-devices

.....

T:  Bus=01 Lev=02 Prnt=02 Port=02 Cnt=01 Dev#=  3 Spd=1.5 MxCh= 0
😧  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0665 ProdID=5161 Rev=00.02
😄  #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I:  If#=0x0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid

Link to comment
Share on other sites

17 hours ago, Mark1981 said:

pi@raspberrypi:/sys/class/tty $ usb-devices

.....

T:  Bus=01 Lev=02 Prnt=02 Port=02 Cnt=01 Dev#=  3 Spd=1.5 MxCh= 0
😧  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0665 ProdID=5161 Rev=00.02
😄  #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I:  If#=0x0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=00 Driver=usbhid

You are not liking for a tty device is you use the micro usb or printer type cable. Tty is only for usb serial cables.

 

From your entries hidraw0 is the one you want.

 

 

On 2020/08/03 at 6:45 PM, Theokie said:

Hi Lewis,

The containers will start by themselves, you don't need to run docker-compose.

What do you see when you run


docker ps

Should look something like this: 


pi@raspberrypi:~ $ docker ps
CONTAINER ID        IMAGE                                             COMMAND                  CREATED             STATUS                PORTS                    NAMES
75877f83e7b0        homeassistant/raspberrypi3-homeassistant:stable   "/init"                  2 days ago          Up 2 days                                      home-assistant
9eeeb6e89f7f        containrrr/watchtower                             "/watchtower --inter…"   8 days ago          Up 7 days             8080/tcp                 watchtower
c1099e1bcc4f        eclipse-mosquitto                                 "/docker-entrypoint.…"   8 days ago          Up 7 days             0.0.0.0:1883->1883/tcp   mqtt
e2907cc40d9e        bushrangers/ha-voltronic-mqtt                     "/bin/bash /opt/inve…"   8 days ago          Up 7 days (healthy)                            voltronic-mqtt

 

Let me do this and revert. 

 

However the system does not seem to see my inverter connected. I will install again while the pi is already connected to the inverter. Thank you for the speedy reply. 

Link to comment
Share on other sites

17 hours ago, Mark1981 said:

I have just installed my rasberry PI and connected it to the Axpert inverter

lsusb seems to show the device

pi@raspberrypi:~ $ lsusb 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0665:5161 Cypress Semiconductor USB to Serial
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi:~ $

 

However there is no mapping to a usb port in /dev/ttyUSB at all. From what I understand there should be?

I found this article https://community.cypress.com/thread/30352?start=0&tstart=0 which seems to be talking about the same thing where it is being picked up as an HID device instead of a standard serial device. Mine seems to be doing the same:

From /var/log/messages

Aug  5 06:07:04 raspberrypi kernel: [    2.172735] hid-generic 0003:0665:5161.0001: hiddev96,hidraw0: USB HID v1.11 Device [HID 0665:5161] on usb-0000:01:00.0-1.3/input0

 

I was just wondering if this is a common issue and if there is a simple solution?

 

Bus 001 Device 003: ID 0665:5161 Cypress Semiconductor USB to Serial

That's a usb cable connection? If yes it will identify as hidraw#... 0 is usually the default if you have no other usb devices connected. 

dmesg | grep -i usb

 

will show you which come to specify in the config file. After that the homeassist just started pitching the values

 

Link to comment
Share on other sites

  • 4 months later...
On 2020/07/23 at 1:06 PM, iops said:

Don't have any experience with pd-axpert, I've linked two projects that I've played around with before that have worked for me.

These require a little more work, I was piping the JSON data into InfluxDB and visualising it in Grafana. How are you installing pd-axpert? Maybe I can help.

 

https://github.com/manio/skymax-demo

https://github.com/lluisball/godenerg

If you can maybe help me with this. I have ICC but I enjoy the dashboards of Grafana

Link to comment
Share on other sites

On 2020/08/03 at 6:32 PM, Lewis said:

Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

Bus 001 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

Looks like they've switched the vendor for their USB->Serial chip.

What do you get when you run:

ls /dev/

 

EDIT: I see this post is really old, but still curious if it shows up under dev with the different chip.  Or maybe the inverter is a fake/clone?

Edited by Gnome
Link to comment
Share on other sites

  • 1 month later...
On 2020/08/03 at 10:03 PM, Lewis said:

Thank you good night. I then tried 

12. sudo docker exec -it voltronic-mqtt bash -c '/opt/inverter-cli/bin/inverter_poller -d -1'


[email protected]'s password:
Linux raspberrypi 5.4.51-v7l+ #1327 SMP Thu Jul 23 11:04:39 BST 2020 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Aug  3 21:56:37 2020
pi@raspberrypi:~ $ sudo docker exec -it voltronic-mqtt bash -c '/opt/inverter-cli/bin/inverter_poller -d -1'
Mon Aug  3 20:01:18 2020 INVERTER: Debug set
Mon Aug  3 20:01:18 2020 INVERTER: Current CRC: 49 C1
Mon Aug  3 20:01:18 2020 INVERTER: QMOD reply size (5 bytes)
Mon Aug  3 20:01:18 2020 INVERTER: QMOD: incorrect start/stop bytes.  Buffer: (N configuration options for the actual inverter polling process...
# This config file is for Axpert King 5KW 48V version.
# I will try and get more config options for other models.

# The device to read from...
# Use: /dev/ttyS0 if you have a serial device,
#      /dev/ttyUSB0 if a USB<>Serial,
#      /dev/hidraw0 if you're connecting via the USB port on the inverter.

device=/dev/ttyUSB0

# How many times per hour is the program going to run...
# This is used to calculate the PV & Load Watt Hours between runs...
# If unsure, leave as default - it will run every minute...

# (120 = every 30 seconds)...
run_interval=120

# This allows you to modify the amperage in case the inverter is giving an incorrect
# reading compared to measurement tools.  Normally this will remain '1'
amperage_factor=1.0

# This allows you to modify the wattage in case the inverter is giving an incorrect
# reading compared to measurement tools.  Normally this will remain '1'
watt_factor=1.01


# The following settings allow you to
Mon Aug  3 20:01:18 2020 INVERTER: Current CRC: B7 A9
Mon Aug  3 20:01:21 2020 INVERTER: QPIGS read timeout
Mon Aug  3 20:01:21 2020 INVERTER: QPIGS reply too short (7 bytes)
Mon Aug  3 20:01:21 2020 INVERTER: Current CRC: F8 54
Mon Aug  3 20:01:24 2020 INVERTER: QPIRI read timeout
Mon Aug  3 20:01:24 2020 INVERTER: QPIRI reply too short (14 bytes)
Mon Aug  3 20:01:24 2020 INVERTER: Current CRC: B4 DA
Mon Aug  3 20:01:27 2020 INVERTER: QPIWS read timeout
Mon Aug  3 20:01:27 2020 INVERTER: QPIWS reply too short (2 bytes)
^Cpi@raspberrypi:~ $ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 003: ID 1997:1221
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 

@Lewisdid you ever come right with this? I've got the same problem and can't seem to get anything to work.

Link to comment
Share on other sites

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...