Closed Hoggel0815 closed 3 years ago
Try sudo apt-get install python3-libusb1
to install the Python 3 version instead of the Python 2 version.
Thanks for the fast answere, but the problem still "No USB libary found". I try to run the example code in weatherstation.py
`import weatherstation
ws = weatherstation.WeatherStation() print(ws.get_fixed_block(['min', 'temp_out', 'val']))`
Remove all the pip installed USB stuff and reinstall python3-libusb1 with apt. As it relies on a C library (libusb1) it is much safer to install with apt as that should install the C dependency. then try running pywws-testweatherstation.
I´ve tried it on a fresh other RaspberryPi to run the testweatherstation, but the same issue
What's the output of dpkg -l | grep -i libusb
?
ii libusb-0.1-4:armhf 2:0.1.12-32 armhf userspace USB programming library ii libusb-1.0-0:armhf 2:1.0.22-2 armhf userspace USB programming library ii libusb-1.0-doc 2:1.0.22-2 all documentation for userspace USB programming ii libusbmuxd4:armhf 1.1.0~git20181007.07a493a-1 armhf USB multiplexor daemon for iPhone and iPod Touch devices - library ii python3-libusb1 1.7-1 all Python wrapper for libusb1 (Python 3)
That's all looking good. What about python3 -c "import pywws.weatherstation"
?
that work´s no output
OK, I think python3 -m pywws.testweatherstation
should work, in which case pywws is installed and working.
Yeah, but
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/pi/.local/lib/python3.7/site-packages/pywws/testweatherstation.py", line 190, in
That's probably because your user account doesn't have permission to access the station's USB port. You can either run everything as root (not a good idea) or set a udev rule to change ownership or permissions on the USB port. https://pywws.readthedocs.io/en/latest/guides/getstarted.html?highlight=udev#test-the-weather-station-connection
Ok, my Mission was to get simple weather informations like temperature in and out, wind speed, wind direction, rainfall.
So i want to create a object from weatherherstation and thought to get informations over ws.get_fixed_block(['min', 'temp_out', 'val'])` in my programm, for example.
Is that feasible?
The "fixed block" probably isn't what you want - it stores things like the highest and lowest temperature the station has ever recorded. Have a look at the pywws.testweatherstation module. Its -h option fetches the most recently logged data which includes temperatures and wind direction.
Rainfall is slightly tricky as the data is a cumulative amount since the outside sensors were last reset. You'll need to store a previous reading and compare the two to see how much rain has fallen in that time interval.
Now i got enough to work with, you are great thanks a lot @jim-easterbrook
import pywws.weatherstation
import pprint
def raw_dump(pos, data):
print("%04x" % pos, end=' ')
for item in data:
print("%02x" % item, end=' ')
print('')
ws = pywws.weatherstation.WeatherStation()
history_count = 10
fixed_block = ws.get_fixed_block()
ptr = fixed_block['current_pos']
for i in range(history_count):
print("0x%04x" % ptr, end=' ')
data = ws.get_data(ptr)
pprint.pprint(data)
ptr = ws.dec_ptr(ptr)
Hi,
i try to run on my RaspberryPi4 with Python3.7 the weatherstation.py, to get some easy weatherinformations for a own python Projekt, but everything i´ve try to run the programm doesent work and i end up with No USB libary found".
I´ve trying "pip3 install libusb", "pip3 install usb", "sudo apt-get install python-libusb1.0.0", "sudo apt-get install python-usb", "pip3 install pyusb"
Any ideas to try something else?