May 2, 20197 yr 1 hour ago, Venno said: Is there another communication channel --Rs232 maybe Yes. There is a comms port, disguised as an RJ-45 connector (usually used for networking). Use the provided RJ-45 to D9 cable, and the D9 is standard RS-232. Or make your own cable; it's a non-standard pinout. 1 hour ago, Venno said: Also is it normal for the inverter to go to grid when the solar power in is Zero even if it has not reached the setting bin program 12 If the battery voltage gets to 2.0 V above the battery low cutoff setting (setting 29), it acts the same as hitting the back-to-utility setting (setting 12). The battery voltage has to climb to the cutoff setting plus 4.0 V for the battery to no longer be declared "low". These thresholds are divided by 4 (so 0.5 and 1.0 V) in the LFP flavour of the patched firmware. So just adjust down the battery low cutoff setting. If the output source priority (setting 01) is SOL, then with zero PV the inverter will switch to grid power by design. If you don't want this (to keep your battery charged in readiness for blackouts), then use setting SbU (Utility last).
May 2, 20197 yr 2 hours ago, Venno said: Hi All Sorry if this is not the right topic but please advise Complete new guy here needs some help with MECER 5kw comms I have it hooked up to Raspberry pi -- USB and am able to read QPIGS etc the communication is very erratic with the inverter it hang while waiting for QPIGS to send the 110 bytes It works most of the time but hangs after a period Is there another communication channel --Rs232 maybe I have even got a separate python program running the QPIGS and QMOD writing that to file and the web page reading the file, but it still hangs so I cant log consistent Data or display it on my page updated every few seconds Is there a trick to this some of you guys seem to have solved this Also is it normal for the inverter to go to grid when the solar power in is Zero even if it has not reached the setting bin program 12 I haven't got any problem reading my inverter. You can try our script (hibrido_test) or our APP (Voltron APP). You're free to test both. If you've any problem with language, leave a comment. The script auto detect port (/dev/hidrawX) and CRC In this case (alpha version), you need to edit voltron.py and modify the port. Edited May 2, 20197 yr by nikitto
May 2, 20197 yr thanks for the quick reply @coulomb Do you also have problems with it hanging or is it only me? do you have a simple program for rs232 comms -- send qpigs and wait for answer ? @ nikkitto I use your program to read I cant see you hidraw -- do i have to login to that site to see it ( hibrido test)? thanks so far
May 2, 20197 yr 31 minutes ago, Venno said: thanks for the quick reply @ nikkitto I use your program to read I cant see you hidraw -- do i have to login to that site to see it ( hibrido test)? thanks so far We're using module timeout_decorator to exit from definition if there's some problem. You've to install these programs: $ sudo pip install crc16 $ sudo pip install timeout_decorator To run program: $ sudo python hibrido_test.py cmd1 cmd2 or $ sudo python hibrido_test.py cmd1 cmd2 -R You can send one or more commands at the same time. Also, with -R (repeat these commands every few seconds) As I said, you don't need to setting port or CRC. hibrido_test.py Edited May 2, 20197 yr by nikitto
May 2, 20197 yr Thank you very much -- Iw am waiting to get access to the other site to download the files?
May 2, 20197 yr Just now, Venno said: Thank you very much -- Iw am waiting to get access to the other site to download the files? I attached the file in the post before.
May 2, 20197 yr Yes. $ sudo python hibrido_test.py QPIGS QPI QMOD QPIRI QID .... Edited May 2, 20197 yr by nikitto
May 2, 20197 yr Traceback (most recent call last): File "niki.py.py", line 79, in <module> r = comando('QPI') File "/usr/local/lib/python2.7/dist-packages/timeout_decorator/timeout_decorator.py", line 91, in new_function return timeout_wrapper(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/timeout_decorator/timeout_decorator.py", line 150, in __call__ return self.value File "/usr/local/lib/python2.7/dist-packages/timeout_decorator/timeout_decorator.py", line 173, in value raise load UnboundLocalError: local variable 's' referenced before assignment Hi Nikitto Hi I get this error on QMOD -- rest work well
May 2, 20197 yr Hi I ran the following and it seems much better now sudo chmod -R 0666 /dev/hidraw0 Do I have to run it every time I reboot Thanks again
May 2, 20197 yr 15 minutes ago, Venno said: ... Hi I get this error on QMOD -- rest work well Try it again or maybe this command doesn't exist in your inverter. $ sudo python hibrido_test.py QMOD
May 2, 20197 yr 1 minute ago, Venno said: Hi I ran the following and it seems much better now sudo chmod -R 0666 /dev/hidraw0 Do I have to run it every time I reboot Thanks again You don't need to change the directory permission, just use 'sudo'
May 2, 20197 yr Hi Nikitto does not give error now that i ran that chmod it works every time previously it ran some times and some times not not sure how to explain it seems to be working now going to get it to feed my web page now Thanks for your support Any advise would be appreciated
May 3, 20197 yr 10 hours ago, Venno said: Do you also have problems with it hanging or is it only me? do you have a simple program for rs232 comms -- send qpigs and wait for answer ? I don't wait for an answer. It's not so reliable that you can do that. I use a Node Red program written by a colleague. It accumulates packets till a carriage return is seen, then goes into a giant parallel switch statement that matches the various fields of the various command responses. Occasionally a response doesn't come; too bad, that's one lost data point out of thousands. Occasionally commands will mangle together in the inverter, and it NAKs them. Occasionally you get mangled responses; usually these don't fit the regular expression for the fields, but if they do, then you get the occasional glitch response. Again, one in thousands is like this. Node Red has the advantage that you send commands separately from waiting for them, effectively in parallel. Actually, waiting isn't the right word, you get a message sent when a field is ready.
May 3, 20197 yr Hi Coulomb I dont have experience with NODE RED Are you using USB or rs232 to comm with inverter Thanks for the response -- is you code proprietary ? would like to look at it if not thanks again to all mine is working better now and I can control my main/grid better now
May 3, 20197 yr 7 hours ago, Venno said: Are you using USB or rs232 to comm with inverter Oh, RS-232; USB is somewhat tricky. 7 hours ago, Venno said: Thanks for the response -- is you code proprietary ? would like to look at it if not It's not proprietary, but it's fairly specific to the needs of our system, with a LyteFyba BMS, for example. Also, it's not easy to publish the "source code" for Node Red, as it's a graphical language. We also really don't want to field requests to modify or maintain it.
May 3, 20197 yr 19 hours ago, Venno said: Any advise would be appreciated I've got a mix with Python, microPython (nodeMCU), PHP, HighCharts, MQTT, MySQL, Telegram, ...
May 5, 20197 yr Hi Nikitto Just some feedback wrt the file u gave me Its working very very well now thank you very much i write the output to a file and then whoever in the family open the page it only polls the file and does not try to reestablish comm with the inverter thank you very much -- life saver
December 1, 20196 yr On 2017/05/03 at 11:48 AM, Gnome said: The block device doesn't allow reading more than 8 characters at a time. So read 8 characters at a time until you get \r or some timeout is reached. I didn't post this because my testing was a command that was 8 or fewer characters IIRC. Only after did I realize that the limitation. If you want cross-platform however (eg. Windows/*BSD/Mac/Linux/etc.), it is worth looking into HIDApi. It is a C library but both Python and Ruby using FFI makes it really easy to use. Or just use C++ JNI would be a bitch IMO. Wish Java had FFI as part of the standard lib... Hi Gnome... Do you still have the Mecer 5kw MPPT module....0848107816 is my number.
May 4, 20206 yr Hi, sorry to revive an old topic. I have had to rebuild my Raspberry PI 2 with the latest "Buster" version of Raspbian and I now have to run the code in Python 3. Has anyone managed to convert this code to work in Python 3? I know that commands like ".encode('string-escape')" are no longer supported and, while I seemed to get it working without this, by returning as a byte array, the rate of failure is much higher than it used to be. If I repeatedly query the inverter via USB every 15 seconds, around 1 in 10 queries result in a valid response. Most of the time I get either 0 response or the start or end of the returned value is garbage or missing, resulting in less data than expected for the QPIGS command. Some help here would really be appreciated as I was up until 5am Sunday morning trying to get this to work and spent several hours on Sunday also trying to get it to work.
May 4, 20206 yr Author 3 hours ago, Lindsay said: Hi, sorry to revive an old topic. I have had to rebuild my Raspberry PI 2 with the latest "Buster" version of Raspbian and I now have to run the code in Python 3. Has anyone managed to convert this code to work in Python 3? I know that commands like ".encode('string-escape')" are no longer supported and, while I seemed to get it working without this, by returning as a byte array, the rate of failure is much higher than it used to be. If I repeatedly query the inverter via USB every 15 seconds, around 1 in 10 queries result in a valid response. Most of the time I get either 0 response or the start or end of the returned value is garbage or missing, resulting in less data than expected for the QPIGS command. Some help here would really be appreciated as I was up until 5am Sunday morning trying to get this to work and spent several hours on Sunday also trying to get it to work. Can you post a code snippet? Did you change your USB cable? - I've had faulty USB cables lead to bad data Is a single command working sometimes but not other times? Or are only some commands working and others not? (this is actually important for a few reasons)
May 4, 20206 yr Hi Gnome, To give some further background, my SD card in my Raspberry PI went corrupt and during rebuilding now 2 years on, some of the libraries for an ADS1115 that I also monitor now appear to only work in Python 3. Since I access both the inverter and the ADS1115 from the same script I am forced to upgrade it to run on Python 3. When I had problems getting it to run in Python 3 I created a test script that just reads from the inverter. I then fixed it as best I could to run in Python 3, however as mentioned I only get a full valid response for around 10% of the time. Raspbian Buster does actually also support Python 2, so if I call this exact same script in Python 2 then it works around 80% of the time. My 2 years old script would also fail sometimes in Python 2 and I'd just retry and get a value. So I'm pretty sure it's not the cable. I am only using the QPIGS command, calling every 15 seconds, I just need to read the current voltage, solar watts etc. I'll have to post my code tonight. It's a bit hacked together to try anything to get it to work - first it wouldn't even run due to functions no longer supported in Python 3, then I was either getting errors or no response, so getting it to 10% was actually an improvement 😕 I'm also going to try run the hibrido_test.py posted above. Thanks!
May 4, 20206 yr Author 52 minutes ago, Lindsay said: I am only using the QPIGS command, calling every 15 seconds, I just need to read the current voltage, solar watts etc. If all you want is to run commands on the inverter, I also have something available you can use: curl 'https://raw.githubusercontent.com/voltronic-inverter/web/master/raspberry-pi/install.sh' | bash sudo reboot now More details in the README Thereafter you'll get the same result by just doing an HTTP call. Very easy to write in Python, Bash, etc. curl -X POST -d 'QPIGS' 'http://127.0.0.1:8080/voltronic/usb' ^ HTTP Post to localhost, the post content is the command and if the response is 200, then that is the data. If the response is 500, it'll contain the reason for the error. 400 error response will indicate some form of client error. 52 minutes ago, Lindsay said: Hi Gnome, To give some further background, my SD card in my Raspberry PI went corrupt and during rebuilding now 2 years on, some of the libraries for an ADS1115 that I also monitor now appear to only work in Python 3. Since I access both the inverter and the ADS1115 from the same script I am forced to upgrade it to run on Python 3. When I had problems getting it to run in Python 3 I created a test script that just reads from the inverter. I then fixed it as best I could to run in Python 3, however as mentioned I only get a full valid response for around 10% of the time. Raspbian Buster does actually also support Python 2, so if I call this exact same script in Python 2 then it works around 80% of the time. My 2 years old script would also fail sometimes in Python 2 and I'd just retry and get a value. So I'm pretty sure it's not the cable. I am only using the QPIGS command, calling every 15 seconds, I just need to read the current voltage, solar watts etc. I'll have to post my code tonight. It's a bit hacked together to try anything to get it to work - first it wouldn't even run due to functions no longer supported in Python 3, then I was either getting errors or no response, so getting it to 10% was actually an improvement 😕 I'm also going to try run the hibrido_test.py posted above. Thanks! If you are adamant about getting your script working, you would need to post some code snippets, but IMO the most likely issue you are running into is python is trying to do some kind of character encoding on the response. Your input I assume is a fixed string: QPIGS<CRC>\r So that should really be consistently correct.
May 4, 20206 yr 50 minutes ago, Gnome said: If all you want is to run commands on the inverter, I also have something available you can use: curl 'https://raw.githubusercontent.com/voltronic-inverter/web/master/raspberry-pi/install.sh' | bash sudo reboot now More details in the README Thereafter you'll get the same result by just doing an HTTP call. Very easy to write in Python, Bash, etc. curl -X POST -d 'QPIGS' 'http://127.0.0.1:8080/voltronic/usb' ^ HTTP Post to localhost, the post content is the command and if the response is 200, then that is the data. If the response is 500, it'll contain the reason for the error. 400 error response will indicate some form of client error. If you are adamant about getting your script working, you would need to post some code snippets, but IMO the most likely issue you are running into is python is trying to do some kind of character encoding on the response. Your input I assume is a fixed string: QPIGS<CRC>\r So that should really be consistently correct. This is cool, will check it out. 50 minutes ago, Gnome said: If you are adamant about getting your script working, you would need to post some code snippets, but IMO the most likely issue you are running into is python is trying to do some kind of character encoding on the response. Your input I assume is a fixed string: QPIGS<CRC>\r So that should really be consistently correct. Yes, I am still to get home and post some code But I am using QPIGS as you mention. I see the the file handling and character encoding changed between Python 2 & 3, I found a couple of resources to look at: https://portingguide.readthedocs.io/en/latest/strings.html#file-i-o https://medium.com/better-programming/strings-unicode-and-bytes-in-python-3-everything-you-always-wanted-to-know-27dc02ff2686 https://docs.python.org/3/howto/unicode.html https://realpython.com/python-encodings-guide/ So this is probably the issue!
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.