manio/skymax-demo

INVERTER: QPIRI: incorrect start/stop bytes.

dilyanpalauzov opened this issue · 3 comments

My /etc/inverter/inverter.conf contains:

device=/dev/hidraw0
run_interval=1
amperage_factor=1.0
watt_factor=1.01

Calling stdbuf -e0 -o0 strace -s2048 ./inverter_poller -d |&tee e contains e.txt.

As can be seen, inverter_poller does not open the device. As can be seen, the device /dev/hidraw0 is not opened and the output contains INVERTER: QPIRI: incorrect start/stop bytes. Buffer: (230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 48.0 44.0 59.5 54.7 2 02 100 0 1 3 9 01 0 1 54.0 0 1 0 00014 000.

Ah, I had to call strace -f. This is the output of stdbuf -o0 -e0 strace -fs2048 ./inverter_poller -d &>E.txt:
E.txt

It contains:

[pid  4886] openat(AT_FDCWD, "/dev/hidraw1", O_RDWR|O_NONBLOCK) = 3
[pid  4886] ioctl(3, TCGETS, 0x76b88d78) = -1 EINVAL (Неправилен аргумент)
[pid  4886] ioctl(3, TCGETS, 0x76b88d70) = -1 EINVAL (Неправилен аргумент)
[pid  4886] ioctl(3, SNDCTL_TMR_START or TCSETS, {B2400 -opost -isig -icanon echo ...}) = -1 EINVAL (Неправилен аргумент)
[pid  4886] ioctl(3, TCFLSH, TCOFLUSH)  = -1 EINVAL (Неправилен аргумент)
[pid  4886] mmap2(NULL, 2097152, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0) = 0x76189000
[pid  4886] munmap(0x76189000, 487424)  = 0
[pid  4886] munmap(0x76300000, 561152)  = 0
[pid  4886] mprotect(0x76200000, 135168, PROT_READ|PROT_WRITE) = 0
[pid  4886] stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2121, ...}) = 0
[pid  4886] openat(AT_FDCWD, "/dev/null", O_WRONLY|O_CREAT|O_APPEND, 0666) = 4
[pid  4886] _llseek(4, 0, [0], SEEK_END) = 0
[pid  4886] fstat64(4, {st_mode=S_IFCHR|0666, st_rdev=makedev(0x1, 0x3), ...}) = 0
manio commented

I know that different inverters has some more or less differences in the reply frame. From what I can see the inverter is properly opened, and properly read, because it is outputting the correct frame:
(230.0 21.7 230.0 50.0 21.7 5000 5000 48.0 48.0 44.0 59.5 54.7 2 02 100 0 1 3 9 01 0 1 54.0 0 1 0 00014 000
So it is responding properly for a query. The problem is probably in some different thing, or protocol differences. I know that even the same inverter may respond differently depending on firmware version, not saying about different devices/clones.

I have four tips for you:

  1. if you have some programming skills: try to see why it is not parsing the data correctly (there is probably some small adjustment in the code which need to be added; I would start from removing start/stop sequence checker)
  2. try https://github.com/ned-kelly/docker-voltronic-homeassistant - as you can see in the readme - it is a fork which is better maintained. My project was rather a demo/proof-of-concept.
  3. try to revert @ned-kelly changes on my project, typing git checkout 48826f4 in the project root directory, rebuild and check again
  4. if you only need to pass the data from your inverter to the grafana, then you may also consider using hard. You can then disable all unnecessary modules and set it to use skymax and grafana only. Configuration file can then be similar to this: https://skyboo.net/2021/06/huawei-sun2000-monitoring/
    This approach however only supports my inverter and my specific protocol - I am not willing to add more inverters support there as this is a very customized software.

Thanks for your answer. It was a matter of setting qpiri=102 in inverter.conf.