sircuri / GoodWeUSBLogger

Python based logger for GoodWe inverters using USB.
GNU General Public License v3.0
10 stars 7 forks source link

Daemon not running? #6

Closed WPluim closed 6 years ago

WPluim commented 6 years ago

Hi Arjen, I was very, very happy to find your Logger. But I don't get it to work properly, sorry. I keep getting the following question (after starting and stopping): pidfile /var/run/goodwe/goodwecomm.pid does not exist. Daemon not running? I never saw the pidfile, it could not be written and when I provided in a goodwe-subdir in /var/run it disappeared. Printing to the python shell made visible the program had found the Goodwe as device 0x74d747d0 (for example), but was unable to open it. Any ideas? Thanks in advance, Wilfried

sircuri commented 6 years ago

Could you please create a subfolder /var/log/goodwe. After you start, it should write any system errors to that folder. It might reveal some extra information about whats happening. Are you running it as root? Please provide me as much information as you can gather and I'll try to help solve the issue.

WPluim commented 6 years ago

Sure, thanks! Starting with a clean copy of all provided files I get the following in Terminal:

pi@RasPi-solar:~/GoodWeUSBLogger $ sudo su root@RasPi-solar:/home/pi/GoodWeUSBLogger# GoodWe.py start bash: GoodWe.py: command not found root@RasPi-solar:/home/pi/GoodWeUSBLogger# python GoodWe.py start (or: ./GoodWe.py start) Traceback (most recent call last): File "GoodWe.py", line 4, in import configparser ImportError: No module named configparser root@RasPi-solar:/home/pi/GoodWeUSBLogger# python3 GoodWe.py start Traceback (most recent call last): File "GoodWe.py", line 13, in import GoodWeCommunicator as goodwe File "/home/pi/GoodWeUSBLogger/GoodWeCommunicator.py", line 6, in import hidrawpure as hidraw File "/home/pi/GoodWeUSBLogger/hidrawpure.py", line 142 print _HIDIOCSFEATURE(length) ^ SyntaxError: invalid syntax root@RasPi-solar:/home/pi/GoodWeUSBLogger#

In an earlier stage I had to create the two files in the /var/log/goodwe subdir by hand. Both stay empty now. Trying to use Python3, I change line 142 to: print(_HIDIOCSFEATURE(length)). The out-file stays empty, the err-file says:

Traceback (most recent call last): File "GoodWe.py", line 90, in daemon.start() File "/home/pi/GoodWeUSBLogger/daemonpy/daemon.py", line 84, in start self.daemonize() File "/home/pi/GoodWeUSBLogger/daemonpy/daemon.py", line 61, in daemonize open(self.pidfile,'w+').write("%s\n" % pid) FileNotFoundError: [Errno 2] No such file or directory: '/var/run/goodwe/goodwecomm.pid' Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/home/pi/GoodWeUSBLogger/daemonpy/daemon.py", line 64, in delpid os.remove(self.pidfile) FileNotFoundError: [Errno 2] No such file or directory: '/var/run/goodwe/goodwecomm.pid'

Would it have someting to do with permissions? Or would it be easier not to use a pidfile, keep track myself en use separate GWUSB-start and stop scripts?

WPluim commented 6 years ago

Sorry for the bold text :-(

sircuri commented 6 years ago

Your error starts with the fact that it is missing the ConfigParser python module. Did you install all dependencies correctly? Please verify the following are installed:

sudo python -m pip install pyudev sudo python -m pip install ioctl_opt sudo python -m pip install configparser sudo python -m pip install paho-mqtt sudo python -m pip install enum

WPluim commented 6 years ago

I installed:

WPluim commented 6 years ago

I found again time to continue with MY puzzle, indeed not yours. You were right, I missed (the right) configparser and missed the complete enum. While verifying I noticed you must have been using python 2.7. Tried that first and it worked, thanks a lot! Still curious so verified now that python3 is definitly not working. Good to know. Thanks again, for the listening ear and the list op sudo pip install commands. Succes in your new projects!

sircuri commented 6 years ago

I just wanted to post indeed that I'm using Python version 2.7.9 on my Raspberry Pi for this project. I'm anoyed by the fact that python is realy messing up the depedencies and is not backwards compatible in some ways. I too have tried to run it with python 3, but kept hitting a wall with these modules.

I will update the docs about these findings. Thanks for your input.