Closed JensHoRi closed 2 years ago
Have you copied the "config.ini"-File from this project to the folder "/opt/solar" and configured it to your needs?
I did. Only left user and password blank, because mqtt (same machine) no authentication set yet. But tried with dummy values too.
hm ... okay
As i understand the error: the library: configparser has a problem with the "urllib3" and "chardet"
Could you try: pip3 install requests
I found this solution for your warning above: https://stackoverflow.com/questions/56155627/requestsdependencywarning-urllib3-1-25-2-or-chardet-3-0-4-doesnt-match-a-s perhaps there are more ideas for your problem
I user Python 3.9 perhaps this makes difference, but the chance are low, as i understand the problem.
I already tried:
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.22.0)
Can you send me the text of your "config.ini"?
cat /opt/solar/config.ini [BOSSWERK] url = http://admin:Password@x.x.x.x/index_cn.html sn = nnnnnnnnn [MQTT] ip = x.x.x.x port = 1883 username = a password = a
of course with correct IPs and serial number.
Here masqueraded ;)
Ok the error ist not there:
https://www.claudiokuenzler.com/blog/1114/urllib3-or-chardet-doesnt-match-a-supported-version-check-esxi-hardware
here i found something about Ubuntu 20.04: sudo pip3 install --upgrade requests
This installed charset normalizer, so one step ahead, but still an error:
Traceback (most recent call last): File "bosswerkToMqtt3.py", line 126, in <module> url1 = config['BOSSWERK']['url'] File "/usr/lib/python3.8/configparser.py", line 960, in __getitem__ raise KeyError(key)
Hey,
i can reproduce this error on 2 ways:
1.) Whats the user, you start your script with (user1 or root)? I start my script in /home/user1/solar
2.)Change:
path = os.path.dirname(__file__)
config.read(path+'/config.ini')
to
path = os.path.dirname(__file__)
print(path)
config.read(path+'/config.ini')
and show me your output
I have it in /opt/solar like in your readme. Will do those changes some later, only on per phone now
Perhaps it solves the problem, when you start the script in /home/user1/solar Let me know, your results. I also have issue (others), trying to start the script from /opt/solar/ ... but i don't know why :-(
i never finally copied the folder to /opt/ because i changed my solution to nodered and iobroker
Path seems to be empty. So no value printed. Just a blank row
Following change is necessary:
old:
path = os.path.dirname(__file__)
correct:
path = os.path.dirname(os.path.abspath(__file__))
old one gives relative path and because of cd in solar.sh this is always empty ;)
now got the following, but maybe because mi600 is offline at the moment
2022-07-19 18:52:24 Try-Number: 0 Traceback (most recent call last): File "bosswerkToMqtt3.py", line 137, in <module> power, today, total, status_r = getDataFromBosswerk(url1,sn1) File "bosswerkToMqtt3.py", line 59, in getDataFromBosswerk with Display(visible=0, size=(1280, 1024)) as display: File "/usr/local/lib/python3.8/dist-packages/pyvirtualdisplay/display.py", line 54, in __init__ self._obj = cls( File "/usr/local/lib/python3.8/dist-packages/pyvirtualdisplay/xvfb.py", line 44, in __init__ AbstractDisplay.__init__( File "/usr/local/lib/python3.8/dist-packages/pyvirtualdisplay/abstractdisplay.py", line 85, in __init__ helptext = get_helptext(program) File "/usr/local/lib/python3.8/dist-packages/pyvirtualdisplay/util.py", line 13, in get_helptext p = subprocess.Popen( File "/usr/lib/python3.8/subprocess.py", line 858, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'Xvfb'
This change worked for me, try it tomorrow.
You can try it directly: python3 bosswerkToMqtt3.py
Found there are still more packages to install
sudo apt-get install xvfb xvfbwrapper is Python wrapper for running a display inside X virtual framebuffer (Xvfb).
You can install it with:
pip install xvfbwrapper
Ok,thank you very much!
Now it works?
On vacation now. Will check when home again
Same Problem here with Archlinux and Python 3.10:
/opt/solar (git)-[main] % python3 bosswerkToMqtt3.py
2022-08-02 09:06:23
Try-Number: 0
Traceback (most recent call last):
File "/opt/solar/bosswerkToMqtt3.py", line 137, in <module>
power, today, total, status_r = getDataFromBosswerk(url1,sn1)
File "/opt/solar/bosswerkToMqtt3.py", line 59, in getDataFromBosswerk
with Display(visible=0, size=(1280, 1024)) as display:
File "/home/dominion/.local/lib/python3.10/site-packages/pyvirtualdisplay/display.py", line 54, in __init__
self._obj = cls(
File "/home/dominion/.local/lib/python3.10/site-packages/pyvirtualdisplay/xvfb.py", line 44, in __init__
AbstractDisplay.__init__(
File "/home/dominion/.local/lib/python3.10/site-packages/pyvirtualdisplay/abstractdisplay.py", line 85, in __init__
helptext = get_helptext(program)
File "/home/dominion/.local/lib/python3.10/site-packages/pyvirtualdisplay/util.py", line 13, in get_helptext
p = subprocess.Popen(
File "/usr/lib/python3.10/subprocess.py", line 969, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1845, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'Xvfb'
Packages are already installed:
/opt/solar (git)-[main] % pip install xvfbwrapper pyvirtualdisplay
Requirement already satisfied: xvfbwrapper in /home/dominion/.local/lib/python3.10/site-packages (0.2.9)
Requirement already satisfied: pyvirtualdisplay in /home/dominion/.local/lib/python3.10/site-packages (3.0)
Any hints?
@Dominion0815 Hello,perhaps there is a problems with the user rights, could you try starting your script from /home/user/solar ?
User rights are fine, same problem in my home dir:
~/solar (git)-[main] % ./solar.sh
/home/dominion/solar
2022-08-02 09:31:48
Try-Number: 0
Traceback (most recent call last):
File "/home/dominion/solar/bosswerkToMqtt3.py", line 137, in <module>
power, today, total, status_r = getDataFromBosswerk(url1,sn1)
File "/home/dominion/solar/bosswerkToMqtt3.py", line 59, in getDataFromBosswerk
with Display(visible=0, size=(1280, 1024)) as display:
File "/home/dominion/.local/lib/python3.10/site-packages/pyvirtualdisplay/display.py", line 54, in __init__
self._obj = cls(
File "/home/dominion/.local/lib/python3.10/site-packages/pyvirtualdisplay/xvfb.py", line 44, in __init__
AbstractDisplay.__init__(
File "/home/dominion/.local/lib/python3.10/site-packages/pyvirtualdisplay/abstractdisplay.py", line 85, in __init__
helptext = get_helptext(program)
File "/home/dominion/.local/lib/python3.10/site-packages/pyvirtualdisplay/util.py", line 13, in get_helptext
p = subprocess.Popen(
File "/usr/lib/python3.10/subprocess.py", line 969, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1845, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'Xvfb'
Did you installed xvfb??
apt-get install xvfb
ok, so ... no problems with the rights, curious. This page https://archlinux.org/packages/community/any/python-xvfbwrapper/ says something about a dependency of this: https://archlinux.org/packages/extra/x86_64/xorg-server-xvfb/ perhaps that is a hint for your further research
It works: I need to install packages "geckodriver xorg-server-xvfb firefox"
Very good!
No idea, whats missing: