Hi,
I'm struggling with the WallBox python library when using from a script called from Domoticz. When I use the python3 script from terminal all works fine. This is what I've tried so far:
* Create an bash to call the script
/usr/bin/python3 /home/pi/domoticz/scripts/python/WallBox.py
or
Python3 /home/pi/domoticz/scripts/python/WallBox.py
* direct call of the script:
/usr/bin/python3 /home/pi/domoticz/scripts/python/WallBox.py
or
Python3 /home/pi/domoticz/scripts/python/WallBox.py
wallbox.py
#!/usr/bin/python3
import sys
try:
from wallbox import Wallbox
except ImportError:
sys.path.append(sys.path[0] + '/..')
from wallbox import Wallbox
import time
etc
The rights of the script set at 755.
In all cases the wallbox is not found????
This is the domoticz error log:
2021-05-09 13:05:03.830 File "/home/pi/domoticz/scripts/python/WallBox.py", line 8, in <module>
2021-05-09 13:05:03.830 from wallbox import Wallbox
2021-05-09 13:05:03.830 ModuleNotFoundError: No module named 'wallbox'
2021-05-09 13:05:03.831 Error: dzVents: Wallbox: Traceback (most recent call last):
2021-05-09 13:05:03.831 File "/home/pi/domoticz/scripts/python/WallBox.py", line 4, in <module>
2021-05-09 13:05:03.831 from wallbox import Wallbox
2021-05-09 13:05:03.831 ModuleNotFoundError: No module named 'wallbox'
2021-05-09 13:05:03.831
2021-05-09 13:05:03.831 During handling of the above exception, another exception occurred:
2021-05-09 13:05:03.831
2021-05-09 13:05:03.831 Traceback (most recent call last):
2021-05-09 13:05:03.831 File "/home/pi/domoticz/scripts/python/WallBox.py", line 8, in <module>
2021-05-09 13:05:03.831 from wallbox import Wallbox
2021-05-09 13:05:03.831 ModuleNotFoundError: No module named 'wallbox'
2021-05-09 13:05:03.831 ::ERROR::
2021-05-09 13:05:03.831
any suggestions???
Mark
Unable to use WallBox python script from domoticz
Moderator: leecollings
-
- Posts: 23
- Joined: Saturday 03 December 2016 16:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
- waltervl
- Posts: 5910
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Unable to use WallBox python script from domoticz
Domoticz service often runs on elevated rights (root).
Did you install the python Wallbox library with sudo?
Did you install the python Wallbox library with sudo?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Re: Unable to use WallBox python script from domoticz
require root permission
-
- Posts: 23
- Joined: Saturday 03 December 2016 16:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Unable to use WallBox python script from domoticz
Nope...
The solution is:
#!/usr/bin/python3
import sys
try:
from wallbox import Wallbox
except ImportError:
sys.path.append('/home/pi/.local/lib/python3.7/site-packages')
from wallbox import Wallbox
import time
Thanks for the suggestion anyway
Mark
The solution is:
#!/usr/bin/python3
import sys
try:
from wallbox import Wallbox
except ImportError:
sys.path.append('/home/pi/.local/lib/python3.7/site-packages')
from wallbox import Wallbox
import time
Thanks for the suggestion anyway
Mark
Who is online
Users browsing this forum: No registered users and 1 guest