WS-3000

1,728 views
Skip to first unread message

olivier...@gmail.com

unread,
Jan 11, 2018, 4:50:43 PM1/11/18
to weewx-user
Hello,

I am trying to get data from an Ambient Weather WS-3000 station, which should apparently be supported according to http://weewx.com/hardware.html (Fine Offset, HP3000 - the name is slightly different, but it is the same station), without success so far...

I tried the FineOffsetUSB driver, but I get the following error:
fousb: Cannot find USB device with Vendor=0x1941 ProdID=0x8021 Device=None

What's the problem? Is the station not supported, am I using the wrong driver, something else?

See below the output from dmesg and lsusb:

dmesg:
[694192.055677] usb 3-1.4: new full-speed USB device number 6 using xhci_hcd
[694192.167328] hid-generic 0003:0483:5750.0003: hiddev0: USB HID v1.10 Device [MyUSB_HID By viewtool] on usb-0000:00:10.0-1.4/input0
[694192.196027] [usb.003.006] /sys/devices/pci0000:00/0000:00:10.0/usb3/3-1/3-1.4 added.

lsusb:
Bus 003 Device 006: ID 0483:5750 SGS Thomson Microelectronics 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0483 SGS Thomson Microelectronics
  idProduct          0x5750 
  bcdDevice            2.00
  iManufacturer           1 MyUSB_HID
  iProduct                2 By viewtool
  iSerial                 3 8B67ACBA1230
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower              300mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      33
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               2
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               2
Device Status:     0x0001
  Self Powered

Thanks a lot!

mwall

unread,
Jan 11, 2018, 5:55:23 PM1/11/18
to weewx-user
On Thursday, January 11, 2018 at 4:50:43 PM UTC-5, olivier.guyotot wrote:
Hello,

I am trying to get data from an Ambient Weather WS-3000 station, which should apparently be supported according to http://weewx.com/hardware.html (Fine Offset, HP3000 - the name is slightly different, but it is the same station), without success so far...

I tried the FineOffsetUSB driver, but I get the following error:
fousb: Cannot find USB device with Vendor=0x1941 ProdID=0x8021 Device=None

What's the problem? Is the station not supported, am I using the wrong driver, something else?

you need to use the hp3000 driver, which is currently an extension to weewx:


the fousb driver is for ws10x0/20x0/30x0 weather stations.

another complicating factor is that the hp3000 driver is currently written to work with the 'usb' branch of weewx.  so you must install weewx from the source code, specifically from the 'usb' branch:

cd weewx
git checkout usb
./setup.py install

then install the hp3000 extension.

i've run it on macos and linux.  it does not yet read historical records from the hp3000 logger.

m

olivier...@gmail.com

unread,
Jan 12, 2018, 4:11:24 AM1/12/18
to weewx-user
Thanks a lot for your help.

I am now one step further: the station is now correctly detected. But I run into the error below almost immediately.

NOTE: the error shown below occurs when I try to run weewx in a docker container (using pyusb 1.0.2). To rule out problems related to docker, I also tried on another computer, running Linux Mint 18.3, python 2.7.12, pyusb 1.0.0b2 and starting weewx as root. The error message is slightly different but produces the exact same stack trace: USBError: [Errno 32] Pipe error.

Any clue on what I am doing wrong?

Thanks.

weewx[129]: engine: Initializing weewx version 3.8.0
weewx[129]: engine: Using Python 2.7.14 (default, Nov  4 2017, 22:29:35) 
[GCC 4.9.2]
weewx[129]: engine: Platform Linux-4.2.8-x86_64-with-debian-8.9
weewx[129]: engine: Locale is 'C.UTF-8'
weewx[129]: engine: Using configuration file /share/homes/ws3000/weewx.conf
weewx[129]: engine: debug is 1
weewx[129]: engine: Initializing engine
weewx[129]: engine: Loading station type HP3000 (user.hp3000)
weewx[129]: usbhid: usbhid: usbhid_ctypes_hidapi failed
weewx[129]: usbhid: usbhid: usbhid_cython_hidapi failed
weewx[129]: usbhid: usbhid: usbhid_libusb1 failed
weewx[129]: usbhid: usbhid: using usbhid_pyusb1
weewx[129]: hp3000: driver version is 0.6
weewx[129]: hp3000: usb info: pyusb_version=1.0.2
weewx[129]: hp3000: sensor map: {'outHumidity': 'h_2', 'extraHumid6': 'h_8', 'extraHumid4': 'h_6', 'extraHumid5': 'h_7', 'extraHumid2': 'h_4', 'extraHumid3': 'h_5', 'extraHumid1': 'h_3', 'extraTemp6': 't_8', 'extraTemp4': 't_6', 'extraTemp5': 't_7', 'extraTemp2': 't_4', 'extraTemp3': 't_5', 'extraTemp1': 't_3', 'outTemp': 't_2', 'inHumidity': 'h_1', 'inTemp': 't_1'}
weewx[129]: usbhid: pyusb_version=1.0.2
weewx[129]: usbhid: Found USB device with VendorID=0x0483 ProductID=0x5750
weewx[129]: engine: Loading service weewx.engine.StdTimeSynch
weewx[129]: engine: Finished loading service weewx.engine.StdTimeSynch
weewx[129]: engine: Loading service weewx.engine.StdConvert
weewx[129]: engine: StdConvert target unit is 0x1
weewx[129]: engine: Finished loading service weewx.engine.StdConvert
weewx[129]: engine: Loading service weewx.engine.StdCalibrate
weewx[129]: engine: Finished loading service weewx.engine.StdCalibrate
weewx[129]: engine: Loading service weewx.engine.StdQC
weewx[129]: engine: Finished loading service weewx.engine.StdQC
weewx[129]: engine: Loading service weewx.wxservices.StdWXCalculate
weewx[129]: wxcalculate: The following values will be calculated: barometer=prefer_hardware, windchill=prefer_hardware, dewpoint=prefer_hardware, appTemp=prefer_hardware, rainRate=prefer_hardware, windrun=prefer_hardware, heatindex=prefer_hardware, maxSolarRad=prefer_hardware, humidex=prefer_hardware, pressure=prefer_hardware, inDewpoint=prefer_hardware, ET=prefer_hardware, altimeter=prefer_hardware, cloudbase=prefer_hardware
weewx[129]: wxcalculate: The following algorithms will be used for calculations: altimeter=aaNOAA, maxSolarRad=RS
weewx[129]: engine: Finished loading service weewx.wxservices.StdWXCalculate
weewx[129]: engine: Loading service weewx.engine.StdArchive
weewx[129]: engine: Archive will use data binding wx_binding
weewx[129]: engine: Record generation will be attempted in 'hardware'
weewx[129]: engine: Using archive interval of 300 seconds (specified in weewx configuration)
weewx[129]: engine: Use LOOP data in hi/low calculations: 1
weewx[129]: manager: Daily summary version is 2.0
weewx[129]: engine: Using binding 'wx_binding' to database 'weewx.sdb'
weewx[129]: manager: Starting backfill of daily summaries
weewx[129]: engine: Finished loading service weewx.engine.StdArchive
weewx[129]: engine: Loading service weewx.restx.StdStationRegistry
weewx[129]: restx: StationRegistry: Registration not requested.
weewx[129]: engine: Finished loading service weewx.restx.StdStationRegistry
weewx[129]: engine: Loading service weewx.restx.StdWunderground
weewx[129]: restx: Wunderground: Posting not enabled.
weewx[129]: engine: Finished loading service weewx.restx.StdWunderground
weewx[129]: engine: Loading service weewx.restx.StdPWSweather
weewx[129]: restx: PWSweather: Posting not enabled.
weewx[129]: engine: Finished loading service weewx.restx.StdPWSweather
weewx[129]: engine: Loading service weewx.restx.StdCWOP
weewx[129]: restx: CWOP: Posting not enabled.
weewx[129]: engine: Finished loading service weewx.restx.StdCWOP
weewx[129]: engine: Loading service weewx.restx.StdWOW
weewx[129]: restx: WOW: Posting not enabled.
weewx[129]: engine: Finished loading service weewx.restx.StdWOW
weewx[129]: engine: Loading service weewx.restx.StdAWEKAS
weewx[129]: restx: AWEKAS: Posting not enabled.
weewx[129]: engine: Finished loading service weewx.restx.StdAWEKAS
weewx[129]: engine: Loading service weewx.engine.StdPrint
weewx[129]: engine: Finished loading service weewx.engine.StdPrint
weewx[129]: engine: Loading service weewx.engine.StdReport
weewx[129]: engine: Finished loading service weewx.engine.StdReport
weewx[129]: engine: Starting up weewx version 3.8.0
weewx[129]: engine: Station does not support reading the time
weewx[129]: engine: Starting main packet loop.
weewx[129]: hp3000: write: 7b 06 40 7d (len=4)
weewx[129]: engine: Main loop exiting. Shutting engine down.
weewx[129]: engine: Caught unrecoverable exception in engine:
weewx[129]:     ****  [Errno None] error sending control message: Broken pipe
weewx[129]:     ****  Traceback (most recent call last):

weewx[129]:     ****    File "/share/homes/ws3000/bin/weewx/engine.py", line 871, in main

weewx[129]:     ****      engine.run()

weewx[129]:     ****    File "/share/homes/ws3000/bin/weewx/engine.py", line 187, in run

weewx[129]:     ****      for packet in self.console.genLoopPackets():

weewx[129]:     ****    File "/share/homes/ws3000/bin/user/hp3000.py", line 452, in genLoopPackets

weewx[129]:     ****      self._station.send_sequence()

weewx[129]:     ****    File "/share/homes/ws3000/bin/user/hp3000.py", line 520, in send_sequence

weewx[129]:     ****      self.send_cmd(0x06)

weewx[129]:     ****    File "/share/homes/ws3000/bin/user/hp3000.py", line 517, in send_cmd

weewx[129]:     ****      self.write([0x7b, cmd, 0x40, 0x7d])

weewx[129]:     ****    File "/share/homes/ws3000/bin/user/hp3000.py", line 493, in write

weewx[129]:     ****      return self._write(buf)

weewx[129]:     ****    File "/share/homes/ws3000/bin/weeusb/usbhid_pyusb1.py", line 83, in _write

weewx[129]:     ****      timeout=timeout)

weewx[129]:     ****    File "/usr/local/lib/python2.7/site-packages/usb/core.py", line 1043, in ctrl_transfer

weewx[129]:     ****      self.__get_timeout(timeout))

weewx[129]:     ****    File "/usr/local/lib/python2.7/site-packages/usb/backend/libusb0.py", line 593, in ctrl_transfer

weewx[129]:     ****      timeout

weewx[129]:     ****    File "/usr/local/lib/python2.7/site-packages/usb/backend/libusb0.py", line 431, in _check

weewx[129]:     ****      raise USBError(errmsg, ret)

weewx[129]:     ****  USBError: [Errno None] error sending control message: Broken pipe

weewx[129]:     ****  Exiting.
Traceback (most recent call last):
  File "bin/weewxd", line 64, in <module>
    weewx.engine.main(options, args)
  File "/share/homes/ws3000/bin/weewx/engine.py", line 871, in main
    engine.run()
  File "/share/homes/ws3000/bin/weewx/engine.py", line 187, in run
    for packet in self.console.genLoopPackets():
  File "/share/homes/ws3000/bin/user/hp3000.py", line 452, in genLoopPackets
    self._station.send_sequence()
  File "/share/homes/ws3000/bin/user/hp3000.py", line 520, in send_sequence
    self.send_cmd(0x06)
  File "/share/homes/ws3000/bin/user/hp3000.py", line 517, in send_cmd
    self.write([0x7b, cmd, 0x40, 0x7d])
  File "/share/homes/ws3000/bin/user/hp3000.py", line 493, in write
    return self._write(buf)
  File "/share/homes/ws3000/bin/weeusb/usbhid_pyusb1.py", line 83, in _write
    timeout=timeout)
  File "/usr/local/lib/python2.7/site-packages/usb/core.py", line 1043, in ctrl_transfer
    self.__get_timeout(timeout))
  File "/usr/local/lib/python2.7/site-packages/usb/backend/libusb0.py", line 593, in ctrl_transfer
    timeout
  File "/usr/local/lib/python2.7/site-packages/usb/backend/libusb0.py", line 431, in _check
    raise USBError(errmsg, ret)
usb.core.USBError: [Errno None] error sending control message: Broken pipe

olivier...@gmail.com

unread,
Jan 13, 2018, 3:03:56 PM1/13/18
to weewx-user
When I connect the station to a Windows VM, I can successfully read the data using EasyTemp. So I tried to compare what EasyTemp and weewx are sending on the USB bus, using wireshark. Unfortunately, although there are obvious differences, I can't tell what's causing the error.
The two files are attached.
ws3000_linux.pcapng
ws3000_windows.pcapng

olivier...@gmail.com

unread,
Jan 13, 2018, 3:05:26 PM1/13/18
to weewx-user
And by the way, the console's firmware version is 1.1.6

olivier...@gmail.com

unread,
Jan 14, 2018, 6:56:43 AM1/14/18
to weewx-user
Hi again,

I did some more troubleshooting, and I now have the feeling that the driver isn't doing exactly what it should.

First of all, a disclaimer: I am no developer and I know next to nothing about the USB protocol, so please don't be too harsh on me if what I am saying is complete BS.

Now, I wrote a small python script to try to read data from the WS-3000 and I actually managed to get this working fine. So I can safely confirm that the problem doesn't come from the hardware or from the host. The setup I am using is working fine, the issue must be coming from weewx or the HP3000 driver.

According to the output from Wireshark and from what I've read in the driver's code, I *believe* that there are two issues:
1. one is that the driver is sending commands using the 'control' channel.
2. probably not directly related to the error I am seeing, but I don't understand the point of sending all the 0x41, 0x06, 0x08, 0x09, 0x05, 0x03, 0x04 commands. The only interesting ones are 0x03 (current data) and 0x05 (calibration, assuming it must be taken into account to get the 'corrected' temperature).

You can find the small script I wrote attached. The only problem I have is that I have to unplug and replug the station between each run, I probably don't reset everything properly.
You can easily compare the output when sending each of the 0x41, 0x06, 0x08, 0x09, 0x05, 0x03, 0x04 commands, or when sending only 0x03 commands. By the way, this also means that contrary to what is mentioned in the driver, the correct way to distinguish between current data and calibration data is to keep track of which command was sent...

Please let me know if this makes sense or not. I am willing to do any additional test you need in order to get this working correctly.

Thanks a lot.

olivier...@gmail.com

unread,
Jan 14, 2018, 6:57:34 AM1/14/18
to weewx-user
Forgot to attach my script...
usbtest.py

olivier...@gmail.com

unread,
Jan 14, 2018, 8:19:17 AM1/14/18
to weewx-user
I quickly checked how calibration is working. The current data sent back by the station already takes the calibration into account. Therefore, the only useful command that the driver should be sending is the command 0x03.
Also, the results are in °C regardless of the configuration of the console or of the sensors, so there is no need to check the configuration first either.

olivier...@gmail.com

unread,
Jan 14, 2018, 3:35:28 PM1/14/18
to weewx-user
One last comment. I modified the hp3000 driver to get weewx to work with my WS-3000. Somebody more competent than I am will have to do a complete review, but here is what I did (more or less):
- changed the write function. The driver was using the one provided in usbhid_pyusb1.py, which is always using self.dev.ctrl_transfer (control transfer instead of an interrupt transfer).
- changed the read function (order of the parameters seemed incorrect).
- modified the genLoopPackets a bit, to avoid trying to read data when no command has been sent.
- modified the send_sequence, to just send 0x03 commands and nothing else.

With those modifications, weewx is now working fine with my WS-3000. But what I did is only dirty patching to get things working: it helps to show what was wrong, but this cannot be simply reused as is...

The modified driver is attached.
hp3000.py

Peter Grefges

unread,
Aug 19, 2018, 7:31:57 AM8/19/18
to weewx-user
Hi, 

I also have the HP3000 weather station and I spent serveral hours to get it to run with weewx, but without sucess :(

I first found the manuals on github for the HP3000, but it actually does not work.
Now after another 5 hours of try n error i found this topic. 

@olivier: you posted serveral files here in this topic with drivers and so on. Actually i am a Raspberry beginner and I now do not know what to do with these drivers and files. Where do I have to put them, which commands do I have to execute?
Which installation method for weewx I have to use? 

At the moment I have installed it like on the github homepage written:
git clone https://github.com/weewx/weewx
cd weewx
git checkout usb
./setup.py install

I have now folders from weewx at /home/weewx and there also the html site is created, at /home/weewx/public_html
But I also have a weewx folder at /root/weewx


For me as a raspberry beginner it is just overwhelming, there are too much ways to realise one and the same thing...

Maybe somebody can help me? That would be really nice!

best regards

olivier...@gmail.com

unread,
Aug 19, 2018, 9:17:22 AM8/19/18
to weewx-user
Hello Peter,

It has been some time since I worked on this, I am not 100% sure to remember everything correctly and some instructions might be out-dated. All I can say for sure is that I can currently get the data from the WS3000 without any problem. So here is what I think I did...

First of all, forget the 'usb' version of weewx. I am downloading the tar.gz from http://www.weewx.com/downloads/ and doing the install using setup.py as per the instructions here (except for installing the requirements):

For the prerequisites, I simply do (just to create a requirement file that I can reuse later):
echo "configobj
pyephem
pyserial
pyusb
willow
pillow
cheetah
Image
Django==1.11"
> requirements.txt


And then:
pip install -r requirements.txt


Download weewx and run (customize home in setup.cfg if you want to change the default location):
tar xvfz weewx-X.Y.Z.tar.gz
cd weewx
-X.Y.Z
./setup.py build
sudo
./setup.py install


=> at this point, weewx should be installed and working (standard install, you can test the simulator). Now you need to configure it for the HP3000. For this, I am using my own driver. It might not be very well written, but it seems to be doing the trick correctly.

But first some IMPORTANT notes:

1. I am using the WS3000 as a secondary station, and I am merging the data with my primary station using a custom data service. This is optional of course, and my data service is probably not going to work for anybody but me: consider it as a poor example and if you would like to do the same make sure to do all the required changes to ws3000DataService.py.

2. Even if you use the WS3000 on its own, you will probably need to make a few changes and think carefully about how you want to store the data in the database: you have up to 8 sensors, and by default weewx has only 3 columns for temperature and 2 for humidity. So you will probably have to modify the database schema anyway. Read http://www.weewx.com/docs/customizing.htm#archive_database carefully.
What my driver is doing by default is storing all the data from the WS3000 in the extraTemp* and extraHumid* columns, you may want to change this (this can be done in the configuration file). At first you could try to use the default and existing database columns and only try to get the data from 1 sensor, just to confirm that your installation is working properly.


To install my WS3000 driver:

- copy ws3000.py, ws3000Extensions.py, ws3000DataService.py (optional) to <weewx home>/bin/user
- update the database schema to add the extra columns (as defined in ws3000Extensions.py)
- add the following section to your configuration file (doing the configuration using wee_config should also work I think. Check if user.ws3000 is listed by./bin/wee_config --list-drivers)

[WS3000]
    # This section is for the Ambient Weather WS3000

    # The driver to use
    driver = user.ws3000

    # The station model, e.g., WS3000, WS3000-X3, WS3000-X5 (all the same...)
    model = WS3000

# [Optional] The interval at which loop packets should be generated by the driver
# Default is 10
#loop_interval = 15

# [Optional] USB vendor ID and product ID, as returned by lsusb. Only required if the device
# cannot be found with the default values
# Defaults are 0x0483 and 0x5750
#vendor_id = 0x0483
#product_id = 0x5750

# [Optional] By default, all the sensor values are stored in the extraTemp or extraHumid columns. The assumption here is
# that the WS3000 is used as a secondary station to enhance another existing station with additional
# temperature sensors, and that the usual inTemp, outTemp, etc. are already used by the primary station.
# NOTE: of course, the database schema must be modified to include the missing columns.
#[[sensor_map]]
#    extraTemp1 = t_1
#    extraTemp2 = t_2
#    extraTemp3 = t_3
#    extraTemp4 = t_4
#    extraTemp5 = t_5
#    extraTemp6 = t_6
#    extraTemp7 = t_7
#    extraTemp8 = t_8
#    extraHumid1 = h_1
#    extraHumid2 = h_2
#    extraHumid3 = h_3
#    extraHumid4 = h_4
#    extraHumid5 = h_5
#    extraHumid6 = h_6
#    extraHumid7 = h_7
#    extraHumid8 = h_8

And add the following line to the DataBinings section:
[DataBindings]
    [[wx_binding]]
...
        schema = user.ws3000Extensions.ws3000Schema


I hope that this help. It's far from a step by step install guide, but it is the best I can do on a short notice... And because of the number of temp/humidity sensors, some level of customization will be required in any case, both to store the data and to generate the reports.
ws3000.py
ws3000DataService.py
ws3000Extensions.py

Peter Grefges

unread,
Aug 22, 2018, 2:02:31 PM8/22/18
to weewx-user
Thanks for your fast reply and help.
I will try it, but it fear that it is too difficult for me. I just bought the raspberry Pi for the WS3000 weather station and i am a absolute beginner. I thought that everything would have been easier.

So installation of weewx is no problem for me, and the simulator of weewx is working, but changing databases or other things will get difficult because I just do not have the overview what I am actually doing there...

olivier...@gmail.com

unread,
Aug 22, 2018, 2:58:39 PM8/22/18
to weewx-user
OK. How many sensors do you have?
If you are OK with using just 2 for now, the setup can still be pretty simple (I'll explain how). What will become more complex is to store and display the values for any additional sensor.

Peter Grefges

unread,
Aug 25, 2018, 1:27:09 PM8/25/18
to weewx-user
I have 5 sensors, but for a first start 2 would be fine (1x outdoor, 1x indoor).

olivier...@gmail.com

unread,
Aug 28, 2018, 3:57:15 AM8/28/18
to weewx-user
Here is a step by step instruction of the complete installation and setup:

# Install weewx
tar xvfz weewx-3.8.2.tar.gz
cd weewx
-3.8.2

./setup.py build
sudo
./setup.py install
For this last step, use the simulator driver since ws3000 is not yet available.

=> weewx is installed by default in /home/weewx. Update the path in the following instructions is this is not the case.
cp ws3000.py /home/weewx/bin/user/
cp ws3000Extensions
.py /home/weewx/bin/user/

Make sure that the ws3000 is correctly detected:
cd /home/weewx
./bin/wee_config --list-drivers
Module name              Driver name    Version  Status                  
  user
.ws3000              WS3000         0.1                              
  weewx
.drivers.acurite    AcuRite        0.24                              
  weewx
.drivers.cc3000     CC3000         0.19
 
<...>

Then run the following command to reconfigure weewx with the correct driver:
./bin/wee_config --reconfigure

Finally edit weewx.conf, and change the sensor_map in the WS3000 section like this:
[WS3000]
<...>
   
[[sensor_map]]
        inTemp
= t_1
        outTemp
= t_2
        extraTemp1
=
        extraTemp2
=
        extraTemp3
= t_3
        extraTemp4
= t_4
        extraTemp5
= t_5
        extraTemp6
= t_6
        extraTemp7
= t_7
        extraTemp8
= t_8
        inHumidity
= h_1
        outHumidity
= h_1
        extraHumid1
=
        extraHumid2
=
        extraHumid3
= h_3
        extraHumid4
= h_4
        extraHumid5
= h_5
        extraHumid6
= h_6
        extraHumid7
= h_7
        extraHumid8
= h_8

=> this basically tells weewx to store the temperature and humidity from the first 2 sensors (t_1, t_2, h_1 and h_2) into the inTemp, ouTemp, inHumidity and outHumidity columns of the database. Everything else will go to the extraTempx and extraHumidx columns (you must read the map from right to left).
The existing reports will pick up the values from inTemp and ouTemp by default. If you want to include the other columns in your reports, you will have to customize them.

NB: If you want to use metric units in the database, you can also change the following section:
[StdConvert]
<...>
target_unit
= METRICWX

Hope this helps.

olivier...@gmail.com

unread,
Aug 28, 2018, 4:39:18 AM8/28/18
to weewx-user
There is a small mistake in the sensor_map above. It should be:
        inHumidity = h_1
        outHumidity
= h_2


instead of:

gjr80

unread,
Aug 28, 2018, 5:33:58 AM8/28/18
to weewx-user
Hi,

Keep in mind that only extraTemp1, extraTemp2, extraTemp3, extraHumid1 and extraHumid2 are included in the default WeeWX database schema (refer to the Archive Types appendix in the Customization Guide); in other words these are the only extraTempx and extraHumidx obs that will be saved to database. You can certainly still use the others, but you will only be able to use them with the $current tag in a WeeWX report. If you want to use these additional obs in some form of aggregate eg minimums, maximums, averages etc in a WeeWX report you will need to save them to database. This is easily done using a custom schema, refer to the section Adding a new type to the archive database in the Customization Guide.

Gary

olivier...@gmail.com

unread,
Aug 28, 2018, 6:23:47 AM8/28/18
to weewx-user
True, but when I tested the steps that I outlined above I ran into a rather nice surprise: the newly created DB did contain all the extra columns. I assume that weex_config (or weewxd when it create the db) automatically applied the schema specified in ws3000Extensions.py.
For my own setup I had to manually customize the database schema, but I had an already existing database. It looks like this will be done automatically for Peter if he starts with a new database, so all he really has to customize to use the data from his 5 sensors are the reports.

Note that the suggested sensor_map configuration I provided above is just to quickly and simply make use of 2 sensors. In the long run, you may want to consider using a different sensor map (currently, sensors 3 to 5 will be stored in the columns extraTemp3-5 and extraHumid3-5 while extraTemp1-2 and extraHumid1-2 should be empty).

olivier...@gmail.com

unread,
Aug 28, 2018, 6:31:59 AM8/28/18
to weewx-user
Considering the above, it may be a good idea to run
rm archive/weewx.sdb
before starting weewxd for the first time after deploying the driver and doing the configuration... (that's assuming that you don't need or want to keep any of the previous data, if any).

gjr80

unread,
Aug 28, 2018, 6:37:47 AM8/28/18
to weewx-user
My apologies, you are correct. I only looked on the driver file ws300.py which mentions the need to modify the schema. wee_config picks up the modified schema from ws3000Extensions.py and when WeeWX starts up provided there is no database one will be created with the modified schema. Key point being there needs to be no existing database.

My previous post should be ignored.

Gary

Peter Grefges

unread,
Aug 28, 2018, 4:31:28 PM8/28/18
to weewx-user
Thank you very much for your help, this is really awesome!

I just made the installation with you manual. 



At the moment i get the following status: 


root@raspberrypi:~# sudo /etc/init.d/weewx start
[ ok ] Starting weewx (via systemctl): weewx.service.
root@raspberrypi:~# sudo tail -f /var/log/syslog
Aug 28 22:19:57 raspberrypi weewx[461]:     ****    File "/home/weewx/bin/weewx/engine.py", line 188, in run
Aug 28 22:19:57 raspberrypi weewx[461]:     ****      for packet in self.console.genLoopPackets():
Aug 28 22:19:57 raspberrypi weewx[461]:     ****    File "/home/weewx/bin/user/ws3000.py", line 292, in genLoopPackets
Aug 28 22:19:57 raspberrypi weewx[461]:     ****      loop_packet = self.getCurrentValues()
Aug 28 22:19:57 raspberrypi weewx[461]:     ****    File "/home/weewx/bin/user/ws3000.py", line 267, in getCurrentValues
Aug 28 22:19:57 raspberrypi weewx[461]:     ****      raw_data = self._get_raw_data(read_sensors_command)
Aug 28 22:19:57 raspberrypi weewx[461]:     ****    File "/home/weewx/bin/user/ws3000.py", line 359, in _get_raw_data
Aug 28 22:19:57 raspberrypi weewx[461]:     ****      raise weewx.IO_ERROR("Error while fetching " + self._get_cmd_name(hex_command))
Aug 28 22:19:57 raspberrypi weewx[461]:     ****  TypeError: 'int' object is not callable
Aug 28 22:19:57 raspberrypi weewx[461]:     ****  Exiting.



it seems that there is still a small problem. The index.html file is still the one from the simulator.




The sensor map in the config file i made like this: 
[[sensor_map]]
inTemp = t_1
        outTemp = t_5
        extraTemp1 = 
        extraTemp2 = t_2
        extraTemp3 = t_3
        extraTemp4 = t_4
        extraTemp5 = 
        extraTemp6 = 
        extraTemp7 = 
        extraTemp8 = 
inHumidity = h_1
outHumidity = h_5
        extraHumid1 = 
        extraHumid2 = h_2
        extraHumid3 = h_3
        extraHumid4 = h_4
        extraHumid5 = 
        extraHumid6 = 
        extraHumid7 = 
        extraHumid8 = 

My sensor number 1 is the main indoor sensor and my outdoor sensor is sensor number 5.


Peter

Peter Grefges

unread,
Aug 28, 2018, 4:56:44 PM8/28/18
to weewx-user
Another log i got was the following:

raspberrypi weewx[461]: manager: Replace failed for database weewx.sdb: attempt to write a readonly database

vince

unread,
Aug 28, 2018, 5:11:51 PM8/28/18
to weewx-user
On Tuesday, August 28, 2018 at 1:56:44 PM UTC-7, Peter Grefges wrote:
Another log i got was the following:

raspberrypi weewx[461]: manager: Replace failed for database weewx.sdb: attempt to write a readonly database



Difficult to help with you not telling us what command you ran, and what user you tried to run it as....

Since you're a new pi user, it is likely you want to preface whatever command you ran with "sudo" so it runs with privileges...

olivier...@gmail.com

unread,
Aug 29, 2018, 1:51:04 AM8/29/18
to weewx-user
Can you please provide the output of:
lsusb

Also, before starting weewx, make sure to delete the existing database:
rm archive/weewx.sdb

And although it probably doesn't make a lot of difference, try to start weewx with the following command for now, instead of using the service:
./bin/weewxd weewx.conf



olivier...@gmail.com

unread,
Aug 29, 2018, 3:51:53 AM8/29/18
to weewx-user
Also, which raspberry distribution are you using and how did you setup python are the requirements? I'll try to test here with a similar setup.

olivier...@gmail.com

unread,
Aug 29, 2018, 4:39:06 AM8/29/18
to weewx-user
It would also be helpful to have the complete log, from the moment weewx started until you run into the error.

But in the meantime, I did some tests on Raspbian and I indeed ran into an error, caused by a timeout. So here is a possible solution for you:
- edit the file ws3000.py
- on lines 316 (return self.device.write(self.OUT_ep, data=buf, timeout=100)) and 320 (buf = self.device.read(self.IN_ep, self.packet_size, 100)) increase the last parameter of the device.write and device.read function to 1000 instead of 100.
- restart weewx

RistoK

unread,
Oct 25, 2018, 1:54:56 AM10/25/18
to weewx-user
Hi there,

As this is pretty much the only WS3000 thread on this list, I dare to reply to the same thread.
So I bought MISOL WS-HP3001-8MZ 5 channel wireless station  + 2 extra sensors = 7 in total.

First of all, Thanks Olivier for all your work regarding the WS3000 driver & instructions!!! While buying the station I was unsure if it would be possible to connect to RasPi - but looks now very promising due to this thread. I hope also others will find this thread and allow them to configure RasPi for WS3000 data collection :) (keywords for anyone looking for info: linux ubuntu raspberry raspbian debian ws3000 ws3001 hp3000 hp3001 misol weather station)
That's why I wrote this here in some kind of fuzzy tutorial format:

So as said, 'looks promising', but not 100% there..
I have linux background, but this is the first time I'm using weewx, so something to learn there, for sure.

I have 1st gen RasPi with Raspbian:
rhk@ripapi ~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 7.11 (wheezy)
Release:        7.11
Codename:       wheezy
rhk@ripapi ~ $

dmesg shows the connected weather monitor:
[ 1907.168919] usb 1-1.3: new full-speed USB device number 4 using dwc_otg
[ 1907.273512] usb 1-1.3: New USB device found, idVendor=0483, idProduct=5750
[ 1907.273553] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1907.273574] usb 1-1.3: Product: By viewtool
[ 1907.273591] usb 1-1.3: Manufacturer: MyUSB_HID
[ 1907.273608] usb 1-1.3: SerialNumber: 8B6997A71132
[ 1907.291671] hid-generic 0003:0483:5750.0001: hiddev0,hidraw0: USB HID v1.10 Device [MyUSB_HID By viewtool] on usb-20980000.usb-1.3/input0

- Downloaded weewx_3.8.2-1_all.deb from weewx website.
- Install with sudo dpkg -i weewx_3.8.2-1_all.deb
- As that didn't work, installed required dependencies: sudo apt-get install apache python-configobj python-cheetah python-serial python-usb
- reinstall with sudo dpkg -i weewx_3.8.2-1_all.deb - initially configured it to use 'simulator' driver

The weewx web interface seemed to work OK and I got some simulated values there, at http://192.168.1.6/html/weewx (note, change localhost to your RasPi IP, first check with ifconfig)

- Then off to configure the WS3000 driver:
- I downloaded the ws3000DataService.py  ws3000Extensions.py  ws3000.py files from this thread and placed them to /usr/share/weewx/user (NOTE! Installation dir with .deb seems different from what is described above in Olivier's instructions).
- run this, as instructed above:
rhk@ripapi ~ $ echo "configobj

> pyephem
> pyserial
> pyusb
> willow
> pillow
> cheetah
> Image
> Django==1.11" > requirements.txt
rhk@ripapi ~ $ pip install -r requirements.txt
Requirement already satisfied (use --upgrade to upgrade): configobj in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 1))
Downloading/unpacking pyephem (from -r requirements.txt (line 2))
  Cannot fetch index base URL http://pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement pyephem (from -r requirements.txt (line 2))
No distributions at all found for pyephem (from -r requirements.txt (line 2))
Storing complete log in /home/rhk/.pip/pip.log
rhk@ripapi ~ $
So removed pyephem from the list (-> possible issue here, how does the missing ephem impact??) and successful rerun.

Then
rhk@ripapi ~ $ sudo pip install pyephem
[sudo] password for rhk:
Downloading/unpacking pyephem
  Cannot fetch index base URL http://pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement pyephem
No distributions at all found for pyephem
Storing complete log in /root/.pip/pip.log
rhk@ripapi ~ $
 (I can see it listed in the mentioned url, but doesn't install :(


Then I tried to list drivers but ws3000 line was somehow corrupted reporting about missing core or something. So in the ws3000.py file I removed these lines:
import usb.core
import usb.util
as (not with very competent with Python..) I saw that import usb was already there. That seemed to help weewx to identify the drivers:

rhk@ripapi /usr/share/weewx $ ./wee_config --list-drivers

Module name              Driver name    Version  Status
  user.ws3000              WS3000         0.1
  weewx.drivers.acurite    AcuRite        0.24
  weewx.drivers.cc3000     CC3000         0.19
  weewx.drivers.fousb      FineOffsetUSB  1.9
  weewx.drivers.simulator  Simulator      3.0
  weewx.drivers.te923      TE923          0.24
  weewx.drivers.ultimeter  Ultimeter      0.18
  weewx.drivers.vantage    Vantage        3.0.11
  weewx.drivers.wmr100     WMR100         3.3.3
  weewx.drivers.wmr200     WMR200         3.3.5
  weewx.drivers.wmr300     WMR300         0.19rc6
  weewx.drivers.wmr9x8     WMR9x8         3.2.2
  weewx.drivers.ws1        WS1            0.25
  weewx.drivers.ws23xx     WS23xx         0.27
  weewx.drivers.ws28xx     WS28xx         0.35


Then reconfiguring weewx to use WS3000:
rhk@ripapi /usr/share/weewx $ ./wee_config --reconfigure


restarting weewx:
sudo service restart weewx



Then editing the template in /etc/weewx/skins/Standard/index.html.tmpl to try to add a channel or two to see the values.
Then edited the /etc/weewx/weewx.conf file to debug=1, shorter intervals, remap some channels to check I have proper input and not simulated:

However, now restarting weewx:
sudo service restart weewx

and checking log:
tail -n 300 -f /var/log/syslog:
Oct 25 08:10:57 ripapi weewx[6513]: engine: Initializing weewx version 3.8.2
Oct 25 08:10:57 ripapi weewx[6513]: engine: Using Python 2.7.3 (default, Nov 24 2017, 21:13:24) #012[GCC 4.6.3]
Oct 25 08:10:57 ripapi weewx[6513]: engine: Platform Linux-4.1.19+-armv6l-with-debian-7.11
Oct 25 08:10:57 ripapi weewx[6513]: engine: Locale is 'fi_FI.UTF-8'
Oct 25 08:10:57 ripapi weewx[6513]: engine: pid file is /var/run/weewx.pid
Oct 25 08:10:57 ripapi weewx[6517]: engine: Using configuration file /etc/weewx/weewx.conf
Oct 25 08:10:57 ripapi weewx[6517]: engine: Debug is 1
Oct 25 08:10:57 ripapi weewx[6517]: engine: Initializing engine
Oct 25 08:10:57 ripapi weewx[6517]: engine: Loading station type WS3000 (user.ws3000)
Oct 25 08:10:57 ripapi weewx[6517]: ws3000: driver version is 0.1
Oct 25 08:10:57 ripapi weewx[6517]: ws3000: sensor map is {'extraHumid6': 'h_6', 'extraHumid7': 'h_7', 'extraHumid4': 'h_4', 'extraHumid5': 'h_5', 'extraHumid2': 'h_2', 'extraHumid3': 'h_3', 'extraTemp8': 't_8', 'extraHumid1': 'h_1', 'extraTemp6': 't_6', 'extraTemp7': 't_7', 'extraTemp4': 't_4', 'extraTemp5': 't_5', 'extraTemp2': 't_2', 'extraTemp3': 't_3', 'extraHumid8': 'h_8', 'extraTemp1': 't_1'}
Oct 25 08:10:57 ripapi weewx[6517]: import of driver failed: 'module' object has no attribute 'core' (<type 'exceptions.AttributeError'>)
Oct 25 08:10:57 ripapi weewx[6517]: engine: Unable to load driver: 'module' object has no attribute 'core'
Oct 25 08:10:57 ripapi weewx[6517]:     ****  Exiting...


and values on website are not updated any more.

I haven't edited the DB structure, should I?


Not 100% sure this is the order of how events unrolled, but I doubt that somewhere there is some error similar to usb.core that didn't work out in the ws3000.py file..  (and for some reason the website worked

Summary of possible issues:
- ephem missing
- import usb.core and usb.util errors, 'fixed' with import usb
- core error in syslog


-> Any pointers what to do next?
Message has been deleted

olivier...@gmail.com

unread,
Oct 25, 2018, 4:25:09 AM10/25/18
to weewx-user

Hello,

First regarding pyephem: you can probably safely ignore this. Here is a quote from the weewx documentation:
# optional for extended almanac information:
sudo pip install pyephem
So unless you need extended almanac information, skip it.

Then, regarding the usb.core issue. This is because the packages installed by apt are prehistoric ones, so you are probably  still using pyusb 0.4. You can check with
pip list --outdated

to check just how far behind you are... And by the way, the errors that you are getting when using pip to install packages are probably caused by the fact that your version of pip must also be outdated. Try to upgrade it first (but given your issues, not sure that you can do it simply with pip install --upgrade pip).

The solution is NOT to edit the driver, but simply to upgrade pyusb:
pip install --upgrade pyusb

Let's see if you still get some errors after this.

NOTE: in general, I always find that it is best to install the python packages using pip rather than to rely on the distribution packages. I would remove python-configobj python-cheetah python-serial python-usb and reinstall all the modules using pip: I don't think that mixing the two installation methods is really safe: there is always the risk that one might break what the other did.
Of course, this will break the dependencies for the weewx package. Which is why it is also better to install it using the setup tool instead of using the deb package. Or, if you want to stick with deb, try to use a much more recent distribution.

NOTE2: if you are working with a new database, you don't need to upgrade the database schema. So my suggestion is that once you have confirmed that the driver is working properly, delete the existing database to let weewx create a new one from scratch with the appropriate schema.

olivier...@gmail.com

unread,
Oct 25, 2018, 7:17:26 AM10/25/18
to weewx-user
I completely forgot some notes I took when I tested the install on a RPi last time, just found them now:

1. install Raspbian
2. install requirements: apt-get install libjpeg-dev libtiff5-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev tcl8.6-dev tk8.6-dev python-tk
3. copy requirements.txt, weewx.tar.gz and ws3000*.py to the RPi
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
pip install -r requirements.txt

So to update pip on your system, you can use:
wget https://bootstrap.pypa.io/get-pip.py
python
get-pip.py


Then try again to install the missing python requirements, and most importantly, update pyusb.

RistoK

unread,
Oct 26, 2018, 8:14:16 AM10/26/18
to weewx-user
Thanks for your input!!

I updated my Raspbian to Jessie (took about 24 hours or so :D) and log below tells where I'm at now.
It's still possible that there are issues with Python packages. Still using the weewx.deb that requires python-usb from package management. It's possible that compiling weewx from source is the next option..

And now that I checked Debian releaseses I see that I'm so behind.. I thought Jessie was the latest stable but I see it's Stretch already.. -> upgrading/fresh install to that next..

Oct 26 15:07:23 ripapi weewx[17576]: engine: Starting up weewx version 3.8.2
Oct 26 15:07:23 ripapi weewx[17576]: engine: Station does not support reading the time
Oct 26 15:07:23 ripapi weewx[17576]: engine: Starting main packet loop.
Oct 26 15:07:23 ripapi weewx[17576]: ws3000: sending request for sensor_values
Oct 26 15:07:23 ripapi weewx[17576]: ws3000: write: 7b 03 40 7d (len=4)
Oct 26 15:07:23 ripapi weewx[17576]: ws3000: reading results...
Oct 26 15:07:23 ripapi weewx[17576]: ws3000: reading 64 bytes
Oct 26 15:07:23 ripapi weewx[17576]: ws3000: read: 7b 00 25 56 00 da 23 00 cc 28 00 cd 27 00 dc 26 00 b4 28 00 db 27 7f ff ff 40 7d 00 f1 25 c4 05 80 fc c5 8a 4e 14 2f 2c d1 d7 e7 70 9c 7b e5 e1 3e 17 5f 4e 19 72 97 5e 02 1a 0e 52 33 f6 80 ce (len=64)
Oct 26 15:07:23 ripapi weewx[17576]: ws3000: extracting values for sensor_values
Oct 26 15:07:23 ripapi weewx[17576]: ws3000: raw: array('B', [123, 0, 37, 86, 0, 218, 35, 0, 204, 40, 0, 205, 39, 0, 220, 38, 0, 180, 40, 0, 219, 39, 127, 255, 255, 64, 125])
Oct 26 15:07:23 ripapi weewx[17576]: ws3000: data: {'h_6': 40, 'h_7': 39, 'h_4': 39, 'h_5': 38, 'h_2': 35, 'h_3': 40, 'h_1': 86, 't_6': 18.0, 't_2': 21.8, 't_3': 20.4, 't_1': 3.7, 'type': 'sensor_values', 't_7': 21.9, 't_4': 20.5, 't_5': 22.0}
Oct 26 15:07:23 ripapi weewx[17576]: ws3000: packet: {'dateTime': 1540555644, 'extraHumid6': 40, 'extraHumid7': 39, 'extraHumid4': 39, 'extraHumid5': 38, 'extraHumid2': 35, 'extraHumid3': 40, 'extraHumid1': 86, 'extraTemp6': 18.0, 'extraTemp7': 21.9, 'extraTemp4': 20.5, 'extraTemp5': 22.0, 'extraTemp2': 21.8, 'extraTemp3': 20.4, 'usUnits': 17, 'extraTemp1': 3.7}
Oct 26 15:07:53 ripapi weewx[17576]: ws3000: sending request for sensor_values
Oct 26 15:07:53 ripapi weewx[17576]: ws3000: write: 7b 03 40 7d (len=4)
Oct 26 15:07:53 ripapi weewx[17576]: engine: Main loop exiting. Shutting engine down.
Oct 26 15:07:53 ripapi weewx[17576]: engine: Caught unrecoverable exception in engine:
Oct 26 15:07:53 ripapi weewx[17576]:     ****  'int' object is not callable
Oct 26 15:07:53 ripapi weewx[17576]:     ****  Traceback (most recent call last):
Oct 26 15:07:53 ripapi weewx[17576]:     ****    File "/usr/share/weewx/weewx/engine.py", line 877, in main
Oct 26 15:07:53 ripapi weewx[17576]:     ****      engine.run()
Oct 26 15:07:53 ripapi weewx[17576]:     ****    File "/usr/share/weewx/weewx/engine.py", line 188, in run
Oct 26 15:07:53 ripapi weewx[17576]:     ****      for packet in self.console.genLoopPackets():
Oct 26 15:07:53 ripapi weewx[17576]:     ****    File "/usr/share/weewx/user/ws3000.py", line 292, in genLoopPackets
Oct 26 15:07:53 ripapi weewx[17576]:     ****      loop_packet = self.getCurrentValues()
Oct 26 15:07:53 ripapi weewx[17576]:     ****    File "/usr/share/weewx/user/ws3000.py", line 267, in getCurrentValues
Oct 26 15:07:53 ripapi weewx[17576]:     ****      raw_data = self._get_raw_data(read_sensors_command)
Oct 26 15:07:53 ripapi weewx[17576]:     ****    File "/usr/share/weewx/user/ws3000.py", line 359, in _get_raw_data
Oct 26 15:07:53 ripapi weewx[17576]:     ****      raise weewx.IO_ERROR("Error while fetching " + self._get_cmd_name(hex_command))
Oct 26 15:07:53 ripapi weewx[17576]:     ****  TypeError: 'int' object is not callable
Oct 26 15:07:53 ripapi weewx[17576]:     ****  Exiting.

-> Can you point out what's possibly wrong?

usbtest.py:

rhk@ripapi ~ $ sudo python usbtest.py
Starting tests...
ws3000_write: entry
Detecting device...
Device found
Sending control packet
Sending command:  [123, 65, 64, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
An error occurred: (<class 'usb.core.USBError'>, USBError(110, u'Operation timed out'), <traceback object at 0xb69010a8>)
Traceback (most recent call last):
  File "usbtest.py", line 54, in ws3000_write
    data = device.read(0x82, 64, 100)
  File "/usr/local/lib/python2.7/dist-packages/usb/core.py", line 988, in read
    self.__get_timeout(timeout))
  File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 851, in intr_read
    timeout)
  File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 936, in __read
    _check(retval)
  File "/usr/local/lib/python2.7/dist-packages/usb/backend/libusb1.py", line 595, in _check
    raise USBError(_strerror(ret), ret, _libusb_errno[ret])
USBError: [Errno 110] Operation timed out
Tests completed
rhk@ripapi ~ $

olivier...@gmail.com

unread,
Oct 26, 2018, 8:17:52 AM10/26/18
to weewx-user
Did you do the change suggested in my post from Aug 29th?

On RPi, you need to increase the usb timeout. I actually updated my code, but I never uploaded the modified files... so unless you manually made the change, you probably still have a 100 ms timeout, which isn't enough on RPi.

olivier...@gmail.com

unread,
Oct 26, 2018, 9:29:53 AM10/26/18
to weewx-user
Just to clarify, I was referring to the following post:

Risto H. Kurppa

unread,
Oct 26, 2018, 11:24:00 AM10/26/18
to weewx...@googlegroups.com
Hi,

No, I didn't try that, didn't realize that would also apply.
So now I have a fresh Stretch install and will next try to set everything up.
I'll try to collect the required steps here.. https://etherpad.net/p/weewx_raspi  (feel free to help to turn it to a step-by-step tutorial..)

r


--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/qDe-El03C2k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
| risto h. kurppa
| risto at kurppa dot fi
| http://risto.kurppa.fi

RistoK

unread,
Oct 26, 2018, 4:34:54 PM10/26/18
to weewx-user
Hi,

I got it to work, yay!
Raspbian Stretch and using the .deb packaged version + Olivier's ws3000 driver - thank you again Olivier!!!
Full description currently in https://etherpad.net/p/weewx_raspi  (or exact version: https://etherpad.net/p/weewx_raspi/timeslider#1332) - and below to make sure it's stored somewhere.
I also edited the skin to show all values (&drop all wind/barom/... data that I don't have available).


Risto


Setting up WeeWx + WS3000 weather station to Raspberry Pi / Raspbian Stretch
This HOWTO is written using instructions on this thread: https://groups.google.com/forum/#!topic/weewx-user/qDe-El03C2k - all credits go to original authors. Just trying to collect all bits and pieces together here :)


THIS INSTRUCTON WAS TESTED 26.10.2018 WITH A FRESH RASPBIAN STRETCH INSTALLATION on Raspi 1


WeeWX Installation - FROM .DEB PACKAGE
Installing required Debian packages:

sudo apt-get install apache2 python-configobj python-cheetah python-serial python-usb python-imaging python-pillow python-pil sqlite
(on my Raspbian, dependencies are not automatically installed -> a but of a mess to try to get all them and sudo apt --fix-broken install seemed to help)

Download weewx-X.Y.Z.deb package from http://weewx.com/downloads/

Install package with 
sudo dpkg --install weewx-X.Y.Z.deb
[select to use simulator driver here]

See if simulator works http://192.168.1.6/weewx  (or similar address, change IP to your RasPi IP.)

Default directory for weewx seems to be /usr/share/weewx. 
Configuration in /etc/weewx/weewx.conf
WWW folder in /var/www/html/weewx
Database: /var/lib/weewx/weewx.sdb 
Templates: /etc/weewx/skins (or similar)




WS3000 driver download
Download three ws3000 files from  https://groups.google.com/forum/#!topic/weewx-user/qDe-El03C2k message 19.8.2018

- Stop weewx:
    sudo service weewx stop
- copy ws3000.py, ws3000Extensions.py, ws3000DataService.py to /usr/share/weewx/user
- edit the file ws3000.py
- on lines 316 (return self.device.write(self.OUT_ep, data=buf, timeout=100)) and 320 (buf = self.device.read(self.IN_ep, self.packet_size, 100)) increase the last parameter of the device.write and device.read function to 1000 instead of 100.

- Check if user.ws3000 is listed by 
/usr/share/weewx/wee_config --list-drivers

- Run
sudo /usr/share/weewx/wee_config --reconfigure
and select user.ws3000 driver

It may be a good idea to clean the old database and run
sudo rm /var/lib/weewx/weewx.sdb 
before  starting weewxd for the first time after deploying the driver and doing the configuration... (that's assuming that you don't need or want to keep any of the previous data, if any).

Edit conf:
sudo nano /etc/weewx/weewx.conf
and change the sensor_map in the WS3000 section like this:

[WS3000]
<...>
    [[sensor_map]]
        inTemp = t_1
        outTemp = t_2
        extraTemp1 =
        extraTemp2 =
        extraTemp3 = t_3
        extraTemp4 = t_4
        extraTemp5 = t_5
        extraTemp6 = t_6
        extraTemp7 = t_7
        extraTemp8 = t_8
        inHumidity = h_1
        outHumidity = h_2
        extraHumid1 =
        extraHumid2 =
        extraHumid3 = h_3
        extraHumid4 = h_4
        extraHumid5 = h_5
        extraHumid6 = h_6
        extraHumid7 = h_7
        extraHumid8 = h_8

This basically tells weewx to store the temperature and humidity from the first 2 sensors (t_1, t_2, h_1 and h_2) into the inTemp, outTemp, 
inHumidity and outHumidity columns of the database. Everything else will go to the extraTempx and extraHumidx columns (you must read the map 
from right to left). The existing reports will pick up the values from inTemp and ouTemp by default. If you want to include the other columns in your reports, you will have to customize them.

NB: If you want to use metric units in the database, you can also change the following section:
[StdConvert]
<...>
target_unit = METRICWX



Restart weewx and hope for the best:
sudo service weewx restart 

Track system log to see everything looks good:
    tail -n 30 /var/log/syslog 

and see the page at http://192.168.1.6/weewx and hopefully your outside Temperature and Inside Temperature match to your WS3000 channels 1 and 2 values.

now off to /etc/weewx/skins to edit the index file to show all channels you want.. 





WeeWX Installation - FROM SOURCES
This instruction has not been tested as the .deb version worked. However, if you want to install with sources, try this instead of the 'FROM .DEB' section.
    
Installing required Debian packages:
sudo apt-get install apache2 libjpeg-dev libtiff5-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev tcl8.6-dev tk8.6-dev python-t
 
Download weewx-X.Y.Z.tar.gz from http://weewx.com/downloads/ and run (customize home in setup.cfg if you want to change the default location):
tar xvfz weewx-X.Y.Z.tar.gz
cd weewx-X.Y.Z
./setup.py build
sudo ./setup.py install  [select simulator driver here]

Required PIP configuration
echo "configobj
pyephem
pyserial
pyusb
willow
pillow
cheetah
Image
Django==1.11" > requirements.txt

pip install -r requirements.txt

and then follow the ws3000 section above

olivier...@gmail.com

unread,
Oct 26, 2018, 4:54:31 PM10/26/18
to weewx-user
Glad to hear that you got it working! And thanks for howto, much appreciated. That's really something that I should have done long ago, but I never found the time/motivation to do it. 

RistoK

unread,
Oct 28, 2018, 6:00:12 AM10/28/18
to weewx-user
Everything's kind of working now, but

a) Any clues why do I get temperature values of 6400 C (from outside sensor, temperature near 0C / 32F). Then later - it works again. Also this sensor seems to loose connection, it's the one with largest distance from base station. Is it possible that base station receives the signal incorrectly or does this have something to do with base station - weewx / ws3000 adapter connection?
After getting these values I added some MinMax values to StdQC..

[StdQC]

    [[MinMax]]
        extraTemp1 = -40,40,degree_C
        extraTemp2 = 0,40,degree_C
        extraTemp3 = 0,40,degree_C
        extraTemp4 = 0,40,degree_C
        extraTemp5 = 0,40,degree_C
        extraTemp6 = 0,40,degree_C
        extraTemp7 = 0,40,degree_C
        extraTemp8 = 0,40,degree_C
        extraHumid1 = 0,100
        extraHumid2 = 0,100
        extraHumid3 = 0,100
        extraHumid4 = 0,100
        extraHumid5 = 0,100
        extraHumid6 = 0,100
        extraHumid7 = 0,100
        extraHumid8 = 0,100



b) Why does weewx crash every now and then:
Oct 28 07:32:36 ripapi weewx[7963]: manager: Added record 2018-10-28 07:32:00 EET (1540704720) to database 'weewx.sdb'
Oct 28 07:32:37 ripapi weewx[7963]: manager: Added record 2018-10-28 07:32:00 EET (1540704720) to daily summary in 'weewx.sdb'
Oct 28 07:32:40 ripapi weewx[7963]: engine: Shutting down StdReport thread
Oct 28 07:32:47 ripapi weewx[7963]: cheetahgenerator: Generated 14 files for report StandardReport in 7.14 seconds
Oct 28 07:32:54 ripapi weewx[7963]: imagegenerator: Generated 20 images for StandardReport in 7.16 seconds
Oct 28 07:32:54 ripapi weewx[7963]: copygenerator: copied 0 files to /var/www/html/weewx
Oct 28 07:32:54 ripapi weewx[7963]: engine: Caught unrecoverable exception in engine:
Oct 28 07:32:54 ripapi weewx[7963]:     ****  'int' object is not callable
Oct 28 07:32:54 ripapi weewx[7963]:     ****  Traceback (most recent call last):
Oct 28 07:32:54 ripapi weewx[7963]:     ****    File "/usr/share/weewx/weewx/engine.py", line 877, in main
Oct 28 07:32:54 ripapi weewx[7963]:     ****      engine.run()
Oct 28 07:32:54 ripapi weewx[7963]:     ****    File "/usr/share/weewx/weewx/engine.py", line 188, in run
Oct 28 07:32:54 ripapi weewx[7963]:     ****      for packet in self.console.genLoopPackets():
Oct 28 07:32:54 ripapi weewx[7963]:     ****    File "/usr/share/weewx/user/ws3000.py", line 292, in genLoopPackets
Oct 28 07:32:54 ripapi weewx[7963]:     ****      loop_packet = self.getCurrentValues()
Oct 28 07:32:54 ripapi weewx[7963]:     ****    File "/usr/share/weewx/user/ws3000.py", line 267, in getCurrentValues
Oct 28 07:32:54 ripapi weewx[7963]:     ****      raw_data = self._get_raw_data(read_sensors_command)
Oct 28 07:32:54 ripapi weewx[7963]:     ****    File "/usr/share/weewx/user/ws3000.py", line 359, in _get_raw_data
Oct 28 07:32:54 ripapi weewx[7963]:     ****      raise weewx.IO_ERROR("Error while fetching " + self._get_cmd_name(hex_command))
Oct 28 07:32:54 ripapi weewx[7963]:     ****  TypeError: 'int' object is not callable
Oct 28 07:32:54 ripapi weewx[7963]:     ****  Exiting.

Added now debug=1 to learn more..

olivier...@gmail.com

unread,
Oct 28, 2018, 7:57:09 AM10/28/18
to weewx-user
For a), we'll hopefully find out more with debug=1. Haven't seen this with my own station so far.

For b) ... I am not sure yet. I am a noob at Python, there are still many things I don't fully understand properly, including error handling :(
All I can say for now is that:
- in _get_raw_data, the driver first tries to send a command to the station (_write_usb),  then it tries to read the results (_read_usb).
- one of those operation fails for some reason. Here again, we will hopefully know more with debug=1
- in the worst case scenario, (ie. we cannot figure out what's wrong and how to fix this), we could simply modify the driver to ignore the failure and hopefully prevent a complete crash.

But first question: did you increase the timeout both for read and write? What value are you using? I honestly don't know what would be reasonable value, 1000 might still not be enough on Raspberry. Back when I first investigated the issue for Raspberry, I came across a lot of links mentioning issues with USB devices on Raspberry. In one of those, you can see that somebody solved the issue by increasing the timeout to 10000...

olivier...@gmail.com

unread,
Oct 28, 2018, 8:09:54 AM10/28/18
to weewx-user
About the data transmission between the station and the sensors: I also have sensors that are quite far or behind thick walls, with rather poor signal reception. But this has never been a problem for me: the station simply stops displaying any value for the specific sensor, and I don't get any value in weewx, that's all.

So, if the values on your station are always correct but you get 6400 C in weewx, then the problem is most likely coming from the driver. I never tested the algorithm used to convert raw data to meaningful values with temperature around 0°C (or negative values), it could be incorrect.

RistoK

unread,
Oct 28, 2018, 4:53:42 PM10/28/18
to weewx-user
Yes I changed delay to 1000 on both read & write. Didn't increase it now, let's see if I get a debig log if it crashes again.


Regarding values of 6500C from WS3000 driver. Please check these two reads from below. I took my outside unit inside for a while - worked OK - and then put it to freezer for a while and this is what happened when values changed from 0.1C to sub-zero (below 0C). Main unit works without issues.


Oct 28 22:20:55 ripapi weewx[17385]: ws3000: sending request for sensor_values
Oct 28 22:20:55 ripapi weewx[17385]: ws3000: write: 7b 03 40 7d (len=4)
Oct 28 22:20:56 ripapi weewx[17385]: ws3000: reading results...
Oct 28 22:20:56 ripapi weewx[17385]: ws3000: reading 64 bytes
Oct 28 22:20:56 ripapi weewx[17385]: ws3000: read: 7b 00 01 10 00 dc 1f 00 ce 23 00 d1 23 00 d9 22 00 b0 20 00 dd 1e 7f ff ff 40 7d 00 40 7d 2c 00 64 40 7d 00 4e 14 2f 2c d1 d7 e7 70 9c 7b e5 e1 3e 17 5f 4e 19 72 97 5e 02 1a 0e 52 33 f6 80 ce (len=64)
Oct 28 22:20:56 ripapi weewx[17385]: ws3000: extracting values for sensor_values
Oct 28 22:20:56 ripapi weewx[17385]: ws3000: raw: array('B', [123, 0, 1, 16, 0, 220, 31, 0, 206, 35, 0, 209, 35, 0, 217, 34, 0, 176, 32, 0, 221, 30, 127, 255, 255, 64, 125])
Oct 28 22:20:56 ripapi weewx[17385]: ws3000: data: {'h_6': 32, 'h_7': 30, 'h_4': 35, 'h_5': 34, 'h_2': 31, 'h_3': 35, 'h_1': 16, 't_6': 17.6, 't_2': 22.0, 't_3': 20.6, 't_1': 0.1, 'type': 'sensor_values', 't_7': 22.1, 't_4': 20.9, 't_5': 21.7}
Oct 28 22:20:56 ripapi weewx[17385]: ws3000: packet: {'dateTime': 1540758056, 'extraHumid6': 32, 'extraHumid7': 30, 'extraHumid4': 35, 'extraHumid5': 34, 'extraHumid2': 31, 'extraHumid3': 35, 'extraHumid1': 16, 'extraTemp6': 17.6, 'extraTemp7': 22.1, 'extraTemp4': 20.9, 'extraTemp5': 21.7, 'extraTemp2': 22.0, 'extraTemp3': 20.6, 'usUnits': 17, 'extraTemp1': 0.1}
Oct 28 22:21:26 ripapi weewx[17385]: ws3000: sending request for sensor_values
Oct 28 22:21:26 ripapi weewx[17385]: ws3000: write: 7b 03 40 7d (len=4)
Oct 28 22:21:27 ripapi weewx[17385]: ws3000: reading results...
Oct 28 22:21:27 ripapi weewx[17385]: ws3000: reading 64 bytes
Oct 28 22:21:27 ripapi weewx[17385]: ws3000: read: 7b ff e6 10 00 dc 1f 00 cc 23 00 d1 23 00 d9 22 00 b0 20 00 dd 1e 7f ff ff 40 7d 00 40 7d 2c 00 64 40 7d 00 4e 14 2f 2c d1 d7 e7 70 9c 7b e5 e1 3e 17 5f 4e 19 72 97 5e 02 1a 0e 52 33 f6 80 ce (len=64)
Oct 28 22:21:27 ripapi weewx[17385]: ws3000: extracting values for sensor_values
Oct 28 22:21:27 ripapi weewx[17385]: ws3000: raw: array('B', [123, 255, 230, 16, 0, 220, 31, 0, 204, 35, 0, 209, 35, 0, 217, 34, 0, 176, 32, 0, 221, 30, 127, 255, 255, 64, 125])
Oct 28 22:21:27 ripapi weewx[17385]: ws3000: data: {'h_6': 32, 'h_7': 30, 'h_4': 35, 'h_5': 34, 'h_2': 31, 'h_3': 35, 'h_1': 16, 't_6': 17.6, 't_2': 22.0, 't_3': 20.4, 't_1': 6551.0, 'type': 'sensor_values', 't_7': 22.1, 't_4': 20.9, 't_5': 21.7}
Oct 28 22:21:27 ripapi weewx[17385]: ws3000: packet: {'dateTime': 1540758087, 'extraHumid6': 32, 'extraHumid7': 30, 'extraHumid4': 35, 'extraHumid5': 34, 'extraHumid2': 31, 'extraHumid3': 35, 'extraHumid1': 16, 'extraTemp6': 17.6, 'extraTemp7': 22.1, 'extraTemp4': 20.9, 'extraTemp5': 21.7, 'extraTemp2': 22.0, 'extraTemp3': 20.4, 'usUnits': 17, 'extraTemp1': 6551.0}
Oct 28 22:21:27 ripapi weewx[17385]: engine: 2018-10-28 22:21:27 EET (1540758087) LOOP value 'extraTemp1' 6551.0 outside limits (-40.0, 40.0)


Spending a while trying to understand the read HEX values raw array, to me it looks like that as soon as temperature (in C) goes below 0, the variable flips back to max, being propably 6553(.).5 - being FF FF in HEX as can be seen above.

Has WS3000 unit's exported values and/or WS3000 driver been earlier confirmed to work on sub-zero temperatures?
By a quick look I didn't find and indicator telling this is a sub-zero temperature except the fact that 6500C is a bit hot for these sensors :D

Would it be possible in to implement a 'sanity check' in the driver to convert values of let's say over 6000C back to negative range, something like
IF
Temperature over 6000C
THEN
Temperature = Temperature-6553,5


Olivier, do you see this as a doable & reasonable solution? Do you already know where would be the good place in the driver to implement it? (and have you thought of putting the code to github or similar service ;)

olivier...@gmail.com

unread,
Oct 28, 2018, 5:42:55 PM10/28/18
to weewx-user
For reference, the code converting the raw values to a temperature is coming from:
https://github.com/matthewwall/weewx-hp3000

You can see how the values are interpreted in the comments I honestly don't know where the MSB * 256 is coming from.
current data (27 bytes)
00 7b
01 00 ch1 temp MSB
02 eb ch1 temp LSB t1 = (MSB * 256 + LSB) / 10.0
03 25 ch1 hum h1 = hum
04 7f ch2 temp MSB
05 ff ch2 temp LSB
06 ff ch2 hum

In my driver, I simply copied the code as is, in the function _raw_to_data

Now, to answer your questions:

1. Changing the formula to handle negative values would be very simple. The only problem is to figure out which formula should be used. Your suggestion is a possible one, but I would prefer to do (LSB - MSB) / 10. As far as I can tell, this should produce the same results, both for positive and negative numbers, without an if condition.
For example, based on your logs:
* (1 - 0) / 10 = 0.1
* (230 - 255) / 10 = -2.5
In any case we would need to compare the raw data with the temperature displayed by your sensor, for a range of values to confirm that the formula is correct or to come up with a better one. Would you be able to collect this? It would mean leaving the debug=1 mode on for a while, and when you get negative temperatures just compare what the sensor displays with what you get in the logs at the same time.

PS: The line that you would have to edit to change the formula (if you want to do it yourself) is:
if buf[idx] != 0x7f and buf[idx + 1] != 0xff:
record['t_%s' % (ch + 1)] = (buf[idx] * 256 + buf[idx + 1]) / 10.0
You would have to replace it with:
    record['t_%s' % (ch + 1)] = (buf[idx + 1] - buf[idx]) / 10.0

NB: as I said, I never tested the driver with negative values (mine are all indoor sensors). And I wouldn't be surprised if we were the only two persons in the world using weewx with a WS-3000 :) So no, I don't think that anybody ever confirmed anything before (either with my driver or with Matthew's).

NB2: yes, putting the code on github would be nice. I thought about it, but as with the documentation, I never found the time/motivation to do so.

RistoK

unread,
Oct 28, 2018, 6:27:38 PM10/28/18
to weewx-user
Two of us - I feel sorry for everyone else. Think of all the fun they're missing :D


INCORRECT HANDLING OF NEGATIVE TEMPERATURES

Changed the code as you suggested and made a quick test comparing ws3000driver vs. display. Results below:

Display: -0.2 vs log -0.1 (outside temp.)
Oct 29 00:01:02 ripapi weewx[18267]: ws3000: reading 64 bytes
Oct 29 00:01:02 ripapi weewx[18267]: ws3000: read: 7b ff fd 32 00 dc 1e 00 cd 23 00 d2 23 00 d9 21 00 b0 20 00 df 1d 7f ff ff 40 7d 00 40 7d 2c 00 64 40 7d 00 4e 14 2f 2c d1 d7 e7 70 9c 7b e5 e1 3e 17 5f 4e 19 72 97 5e 02 1a 0e 52 33 f6 80 ce (len=64)
Oct 29 00:01:02 ripapi weewx[18267]: ws3000: extracting values for sensor_values
Oct 29 00:01:02 ripapi weewx[18267]: ws3000: raw: array('B', [123, 255, 253, 50, 0, 220, 30, 0, 205, 35, 0, 210, 35, 0, 217, 33, 0, 176, 32, 0, 223, 29, 127, 255, 255, 64, 125])
Oct 29 00:01:02 ripapi weewx[18267]: ws3000: data: {'h_6': 32, 'h_7': 29, 'h_4': 35, 'h_5': 33, 'h_2': 30, 'h_3': 35, 'h_1': 50, 't_6': 17.6, 't_2': 22.0, 't_3': 20.5, 't_1': -0.2, 'type': 'sensor_values', 't_7': 22.3, 't_4': 21.0, 't_5': 21.7}
Oct 29 00:01:02 ripapi weewx[18267]: ws3000: packet: {'dateTime': 1540764063, 'extraHumid6': 32, 'extraHumid7': 29, 'extraHumid4': 35, 'extraHumid5': 33, 'extraHumid2': 30, 'extraHumid3': 35, 'extraHumid1': 50, 'extraTemp6': 17.6, 'extraTemp7': 22.3, 'extraTemp4': 21.0, 'extraTemp5': 21.7, 'extraTemp2': 22.0, 'extraTemp3': 20.5, 'usUnits': 17, 'extraTemp1': -0.2}



DIsplay -5.4 vs log -5.3 (some minutes in the freezer)
Oct 29 00:05:13 ripapi weewx[18267]: ws3000: read: 7b ff ca 27 00 dc 1e 00 cc 22 00 d2 23 00 da 21 00 af 20 00 e0 1d 7f ff ff 40 7d 00 40 7d 2c 00 64 40 7d 00 4e 14 2f 2c d1 d7 e7 7

0 9c 7b e5 e1 3e 17 5f 4e 19 72 97 5e 02 1a 0e 52 33 f6 80 ce (len=64)
Oct 29 00:05:13 ripapi weewx[18267]: ws3000: extracting values for sensor_values
Oct 29 00:05:13 ripapi weewx[18267]: ws3000: raw: array('B', [123, 255, 202, 39, 0, 220, 30, 0, 204, 34, 0, 210, 35, 0, 218, 33, 0, 175, 32, 0, 224, 29, 127, 255, 255, 64, 125])
Oct 29 00:05:13 ripapi weewx[18267]: ws3000: data: {'h_6': 32, 'h_7': 29, 'h_4': 35, 'h_5': 33, 'h_2': 30, 'h_3': 34, 'h_1': 39, 't_6': 17.5, 't_2': 22.0, 't_3': 20.4, 't_1': -5.3,
'type': 'sensor_values', 't_7': 22.4, 't_4': 21.0, 't_5': 21.8}
Oct 29 00:05:13 ripapi weewx[18267]: ws3000: packet: {'dateTime': 1540764313, 'extraHumid6': 32, 'extraHumid7': 29, 'extraHumid4': 35, 'extraHumid5': 33, 'extraHumid2': 30, 'extraHu
mid3': 34, 'extraHumid1': 39, 'extraTemp6': 17.5, 'extraTemp7': 22.4, 'extraTemp4': 21.0, 'extraTemp5': 21.8, 'extraTemp2': 22.0, 'extraTemp3': 20.4, 'usUnits': 17, 'extraTemp1': -5
.3}

DIsplay -11.2 vs log -11.1 (a bit longer in the freezer)
Oct 29 00:12:32 ripapi weewx[18267]: ws3000: read: 7b ff 90 28 00 dc 1e 00 cd 22 00 d2 23 00 d9 21 00 b0 20 00 df 1d 7f ff ff 40 7d 00 40 7d 2c 00 64 40 7d 00 4e 14 2f 2c d1 d7 e7 70 9c 7b e5 e1 3e 17 5f 4e 19 72 97 5e 02 1a 0e 52 33 f6 80 ce (len=64)
Oct 29 00:12:32 ripapi weewx[18267]: ws3000: extracting values for sensor_values
Oct 29 00:12:32 ripapi weewx[18267]: ws3000: raw: array('B', [123, 255, 144, 40, 0, 220, 30, 0, 205, 34, 0, 210, 35, 0, 217, 33, 0, 176, 32, 0, 223, 29, 127, 255, 255, 64, 125])
Oct 29 00:12:32 ripapi weewx[18267]: ws3000: data: {'h_6': 32, 'h_7': 29, 'h_4': 35, 'h_5': 33, 'h_2': 30, 'h_3': 34, 'h_1': 40, 't_6': 17.6, 't_2': 22.0, 't_3': 20.5, 't_1': -11.1, 'type': 'sensor_values', 't_7': 22.3, 't_4': 21.0, 't_5': 21.7}
Oct 29 00:12:32 ripapi weewx[18267]: ws3000: packet: {'dateTime': 1540764752, 'extraHumid6': 32, 'extraHumid7': 29, 'extraHumid4': 35, 'extraHumid5': 33, 'extraHumid2': 30, 'extraHumid3': 34, 'extraHumid1': 40, 'extraTemp6': 17.6, 'extraTemp7': 22.3, 'extraTemp4': 21.0, 'extraTemp5': 21.7, 'extraTemp2': 22.0, 'extraTemp3': 20.5, 'usUnits': 17, 'extraTemp1': -11.1}

DIsplay -16.8 vs log -16.7 (even longer in the freezer)
Oct 29 00:24:04 ripapi weewx[19860]: ws3000: read: 7b ff 58 2a 00 dd 1f 00 cc 22 00 d2 23 00 d9 21 00 b0 20 00 e0 1d 7f ff ff 40 7d 00 40 7d 2c 00 64 40 7d 00 4e 14 2f 2c d1 d7 e7 7

0 9c 7b e5 e1 3e 17 5f 4e 19 72 97 5e 02 1a 0e 52 33 f6 80 ce (len=64)
Oct 29 00:24:04 ripapi weewx[19860]: ws3000: extracting values for sensor_values
Oct 29 00:24:04 ripapi weewx[19860]: ws3000: raw: array('B', [123, 255, 88, 42, 0, 221, 31, 0, 204, 34, 0, 210, 35, 0, 217, 33, 0, 176, 32, 0, 224, 29, 127, 255, 255, 64, 125])
Oct 29 00:24:04 ripapi weewx[19860]: ws3000: data: {'h_6': 32, 'h_7': 29, 'h_4': 35, 'h_5': 33, 'h_2': 31, 'h_3': 34, 'h_1': 42, 't_6': 17.6, 't_2': 22.1, 't_3': 20.4, 't_1': -16.7,
 'type': 'sensor_values', 't_7': 22.4, 't_4': 21.0, 't_5': 21.7}
Oct 29 00:24:04 ripapi weewx[19860]: ws3000: packet: {'dateTime': 1540765444, 'extraHumid6': 32, 'extraHumid7': 29, 'extraHumid4': 35, 'extraHumid5': 33, 'extraHumid2': 31, 'extraHu
mid3': 34, 'extraHumid1': 42, 'extraTemp6': 17.6, 'extraTemp7': 22.4, 'extraTemp4': 21.0, 'extraTemp5': 21.7, 'extraTemp2': 22.1, 'extraTemp3': 20.4, 'usUnits': 17, 'extraTemp1': -1
6.7
}

So it looks like that the ws3000 driver value shows 0.1C warmer than what the display shows.
It's possible that this is a timing issue (changing value when reading) but with all four points having it to me it sounds like something else than timing. Is there something in the code that could cause this?


CRASH
I also now got a crash again. See https://pastebin.com/gvxwdzrs for log.
I wasn't able to read from the log file what happened, something related to driver / device. I now changed the timeout to 10k and let's see if that helps keeping it up.

olivier...@gmail.com

unread,
Oct 29, 2018, 4:16:39 AM10/29/18
to weewx-user
For the negative values:
=> I figured it out, it is in fact quite simple. We have to treat the raw data as a signed short. I'll see how to change the code to take this into account. Shouldn't be difficult.

For the crash:
=> 
- I noticed that at 00:12:31, the driver is sending a command (ws3000: reading results), and it reads the data at 00:12:32.
- Then, at 00:12:35, another command is sent, and this one fails.

That's only a few seconds later. If I remember correctly, I ran into something similar: I was trying to read the data as fast as for my other station (Vantage, for which I get data every second or so). Then I simply fetched the data from the WS-3000 when storing records into the weewx database, so every minute only. I think that this was what solved the problem for me.

How did you configure the loop_interval? Can you try to increase it? Try 30 or 60 seconds at least. For temperature, it doesn't really make sense to fetch the data too often anyway.

RistoK

unread,
Oct 29, 2018, 4:27:54 AM10/29/18
to weewx-user
Negative values - great!!

I didn't change the loop interval:
    # [Optional] The interval at which loop packets should be generated by the driver
    # Default is 10
    loop_interval = 30

Now I changed it to 1min, let's see if crashes still occur..

r

olivier...@gmail.com

unread,
Oct 29, 2018, 4:54:18 AM10/29/18
to weewx-user
Here is the suggested code change for the negative temperature:

First, add the following import near the top of the file (next to the other imports):
import struct
Then, use the following code to compute the temperature
record['t_%s' % (ch + 1)] = struct.unpack('>h', buf[idx:idx+2])[0] / 10.0

I think that this should work properly for all temperatures.
 

olivier...@gmail.com

unread,
Oct 29, 2018, 5:30:10 AM10/29/18
to weewx-user
ok, this is weird. If the interval was already 30 seconds, I don't understand why the driver was trying to fetch the data several times in a short interval (as seen in your log).

What's the output of:
grep "ws3000: write" <log file>
I would like to see how often the driver is fetching data.

I have to admit that I can't remember how this is all supposed to work. My setup is very different: I am using the ws3000DataService to fetch the values from the WS-3000 only when I am writing a record to the database (every 60 seconds). The data is then combined with what I get from my other station. You could say that in my case, the WS-3000 is only a secondary station, and therefore the loop_interval is not taken into account.

In your case (I am assuming that you only have 1 station), it doesn't make sense to use the ws3000DataService. But we need to figure out how weewx and the driver are interacting with the station...
As far as I can tell, the driver is generating loop packets (using the loop_interval). Then, I assume that when weewx is generating an archive record something else must be happening, depending on the values of the archive_interval and maybe record_generation (software or hardware). But I don't know exactly how this is working, and what function weewx is calling to fetch the data (is it calling genLoopPackets again?). I have the feeling that the record generation might trigger an additional query to the station, and if it turns out to be too close to a loop packet generation, then we run into the current issue.

Ideally, you would want to disable the loop packets completely if possible, and just let weewx fetch the data when it needs to generate an archive record. I don't know if this is possible though. But after quickly looking at the documentation, I think that you may have to consider switching record_generation to software. This might help to prevent the problem, if weewx builds the record from previous loop packets rather than be querying the station again.

What is your archive_interval?

RistoK

unread,
Oct 29, 2018, 6:42:17 AM10/29/18
to weewx-user
Applied the sub-zero fix and updated it to https://etherpad.net/p/weewx_raspi

Yes, I only have 1 station currenlty but might at some point add a DHT22 or some DIY air quality sensors.

Oct 29 11:58:58 ripapi weewx[22108]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 11:59:01 ripapi weewx[22108]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:00:01 ripapi weewx[22108]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:01:01 ripapi weewx[22108]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:01:04 ripapi weewx[22108]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:02:04 ripapi weewx[22108]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:03:04 ripapi weewx[22108]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:03:07 ripapi weewx[22108]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:04:08 ripapi weewx[22108]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:05:08 ripapi weewx[22108]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:05:10 ripapi weewx[22108]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:05:36 ripapi weewx[22384]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:07:06 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:08:07 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:09:07 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:09:09 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:10:09 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:11:09 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:11:11 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:12:12 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:13:12 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:13:14 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:14:14 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:14:17 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:15:17 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:16:18 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:16:20 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:17:20 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:18:20 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:18:23 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:19:23 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:20:23 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:20:26 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:21:26 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:22:26 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:22:29 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:23:30 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:24:30 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:24:33 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:25:33 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:26:33 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:26:36 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 12:27:36 ripapi weewx[22446]: ws3000: write: 7b 03 40 7d (len=4)


looks like that it's a bit irregular. I changed the loop interval from 30-> 60 earlier today, but to me it looks like that some 'duplicates' are there.


My weewx.conf visible at https://pastebin.com/gZvFUm5q
-> Please propose changes, if needed.

Archive interval now 2min for test purposes, can change that to 5min if useful. Also if record_generation needs to be changed to software, that's also OK. I haven't yet read very much what do these configs do..


And thanks for your help Olivier :)


r

olivier...@gmail.com

unread,
Oct 29, 2018, 8:48:35 AM10/29/18
to weewx-user
For the sub-zero fix, did you confirm if this is now working as expected?
Also, rather than documenting how to fix the code, it might be better to upload the latest version of the code once we'll have fixed all the issues (although I'll try to document what we did in the code).

For the crash, the output from grep is interesting:
- first, it confirms that when weewx is generating an archive record, it is pulling data from the station (hence the duplicate every 2 minutes).
- since the loop packet and the archive record are generated within a very short time, it is likely that this is what's causing the issue (as I mentioned, that's something I ran into when I initially tested the driver). I wonder if it makes sense to modify the driver to return the latest 'cached' packet when several attempts are made to fetch the data within a short period of time (less than 10 seconds maybe?).

But let's first try to fix this with the configuration: can you try setting record_generation = software to see if it helps to avoid this issue (after the change, leave weewx running for some time then redo the grep)?

Using hardware doesn't really make sense anyway for this station: as far as I can tell the WS-3000 has no concept of loop vs archive packets, all you can do it fetch the current values from the station. So if this works as I expect when using 'software', you could generate loop packets every 30 or 60 seconds, and let weewx generate the archive record every 2 to 5 minutes. weewx will aggregate the data from all the previous loop packets to produce the min/max during this 2 to 5 minutes interval but won't fetch the data again, thus avoid the issue.

olivier...@gmail.com

unread,
Oct 29, 2018, 1:11:05 PM10/29/18
to weewx-user
OK, I couldn't let you do all the work alone, so I retrieved my ws3000 and did some test. Switching to record_generation = software does not prevent the duplicate loop packets. But I would still change the configuration, because hardware just doesn't make any sense (if I understand what this means correctly). I also saw a comment in the documentation mentioning that 'hardware' could cause issues with one station.

So far I haven't gotten any crash, so I'll let weewx run for a while, see if I also get a crash. If not, I'll try to setup my RPi to do the tests.

Risto H. Kurppa

unread,
Oct 29, 2018, 4:15:07 PM10/29/18
to weewx...@googlegroups.com
Sub-zero seems to work, ws3000 driver values match to what the original display shows. Great :) Winter, I'm ready!

I now changed
record_generation = software
archive_interval=120
loop_interval=60
USB read & write timeouts = 10000

Oct 29 22:00:03 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:01:03 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:01:05 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:02:05 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:03:06 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:03:08 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:04:08 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:05:08 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:05:10 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:06:10 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:07:11 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:07:12 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:08:13 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:09:13 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:09:15 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:10:16 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:10:18 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:11:18 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:12:18 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:12:21 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)
Oct 29 22:13:21 ripapi weewx[25186]: ws3000: write: 7b 03 40 7d (len=4)

As every 2nd value is a 'closely timed pair', it really looks like that both, the archive run (120s interval) and loop run (60s interval) read new values from the main unit.



And I agree, that best would be to share the 'final files' - but as this still is strongly a 'work in progress', I use the etherpad to collect the 'current best solution'. I wouldn't have the energy to now upload all files publicly available somewhere after every change :)
-> Let's try to make this stable and release the files somewhere


What RasPi do you have? I have the old RasPi model B rev2 (512MB), if that makes any difference.



On Mon, Oct 29, 2018 at 7:11 PM <olivier...@gmail.com> wrote:
OK, I couldn't let you do all the work alone, so I retrieved my ws3000 and did some test. Switching to record_generation = software does not prevent the duplicate loop packets. But I would still change the configuration, because hardware just doesn't make any sense (if I understand what this means correctly). I also saw a comment in the documentation mentioning that 'hardware' could cause issues with one station.

So far I haven't gotten any crash, so I'll let weewx run for a while, see if I also get a crash. If not, I'll try to setup my RPi to do the tests.

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/qDe-El03C2k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

olivier...@gmail.com

unread,
Oct 29, 2018, 5:28:43 PM10/29/18
to weewx-user
I have Raspberry 2, 1GB but I normally use it as a multimedia player, not for the station. So I just installed it with Raspbian (Stretch), following your guide :) I also made a few adjustments to my code, to try to improve the error reporting, but the syslog module in Python is really crap and limited... we'll see if what I did is enough.

So far, no error. I don't know if this is because of the hardware though. On average, what is the frequency of your crashes?

Note: could you try to start weewx manually instead of using the service?
/usr/bin/weewxd /etc/weewx/weewx.conf

There might be more information logged in the console than in the logs when an exception occurs.

You can use 'screen' to run the command if you don't have a permanent connection to the Raspberry. This way the command will continue to run even if you disconnect from ssh.

olivier...@gmail.com

unread,
Oct 30, 2018, 12:49:35 PM10/30/18
to weewx-user
Here is an updated version of the driver, including:
- the fix for sub-zero temperatures
- improved error handling/retry (something that wasn't working properly before)
- the usb timeout is now a configuration setting
- additional comments

It probably won't fix the root cause of the 'crash' issue, but at least it should now properly retry so the problem might be more transparent. And the error reporting will be more useful to figure out what's wrong should an exception occur.
ws3000.py
ws3000DataService.py
ws3000Extensions.py

Risto H. Kurppa

unread,
Oct 31, 2018, 3:59:49 AM10/31/18
to weewx...@googlegroups.com
Great, I now deployed the updated drivers & restarted on screen with
/usr/bin/weewxd /etc/weewx/weewx.conf

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/qDe-El03C2k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Message has been deleted
Message has been deleted

Ton vanN

unread,
Feb 10, 2020, 10:26:32 AM2/10/20
to weewx-user
This thread makes interesting reading.

Have a Misol console type HP3001 (which probably is a next version/clone of HP3000), and assume therefore that the discussed HP3000/WS3000-driver will be applicable.
5 Sensors attached.
At processor-side have a configuration with Raspbian Buster on Raspberry_Zero_W
Installed ss described by Jack Stromberg at https://jackstromberg.com/2018/06/setting-up-weewx-with-a-raspberry-pi/
Lacking a better choice set WeeWX for 'Simulator'
Seems to work.

Next step is installation of the WS3000-driver, reconfig with that driver and then restart incl. de USB-interface to the Console of WS3000/HP300x
Have read the attachment to previous message, but NOOB needing simple instructions.

Any hints for the next steps?

Op dinsdag 30 oktober 2018 17:49:35 UTC+1 schreef olivier...@gmail.com:

Olivier Guyotot

unread,
Feb 10, 2020, 1:30:49 PM2/10/20
to weewx-user
I haven't touched this in a while (it's just running on its own), my memory is a bit fuzzy... It will take time for me to properly remember everything.

That being said, there are 2 major things to check:
1. that your station is indeed working like a WS3000.
2. what is the correct configuration to use.

Let's start with 2.

In your case, the first thing to check is if you can use the default or if you need to update the vendor_id and product_id.

Just run
lsusb
on your raspberry and please post the output here.


Ton vanN

unread,
Feb 11, 2020, 4:13:06 AM2/11/20
to weewx-user
On command lsusb the following response

Bus 001 Device 002: ID 0483:5750 STMicroelectronics
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub






Op maandag 10 februari 2020 19:30:49 UTC+1 schreef Olivier Guyotot:

Olivier Guyotot

unread,
Feb 11, 2020, 2:17:29 PM2/11/20
to weewx-user
Alright, so the good news is that the vendor_id and product_id are still the same.

NOTE: I just noticed that in your configuration, you specified driver = user.hp3000. Unless you made a change, it should be driver = user.ws3000.

Assuming that you installed the driver correctly in the bin/user directory, to check if the current code is working with your station you could try the following:
1. first, stop weewx.
2. from the weewx folder, run the command:
PYTHONPATH=bin python bin/user/ws3000.py

NOTE: you may have to replace the 'logdbg' statements by 'print', lines 624 and 626, if you don't see the data (check in the logs first).

Something else that you could try is to enable debug in the weewx configuration file (debug = 1), start weewx, and send me the log.

Ton vanN

unread,
Feb 11, 2020, 4:29:08 PM2/11/20
to weewx-user
Olivier,

Puzzled, because apparently weewx has been installed in my configuration in a different way than you expect.
See the inserted text.

;-( Some more thinking to be done ...
Waiting for your next suggestions.

Anton

Op dinsdag 11 februari 2020 20:17:29 UTC+1 schreef Olivier Guyotot:
Alright, so the good news is that the vendor_id and product_id are still the same.

NOTE: I just noticed that in your configuration, you specified driver = user.hp3000. Unless you made a change, it should be driver = user.ws3000.
Where did you see this info?
Or otherwise formulated: where shal I put such line?


Assuming that you installed the driver correctly in the bin/user directory,
In my configuration no folder /bin/user; therefore created and put ws3000.py in that folder with x-attribute set, to enable execution
Most weewx-files found in folder /etc/weewx

to check if the current code is working with your station you could try the following:
1. first, stop weewx.
2. from the weewx folder, run the command:
PYTHONPATH=bin python bin/user/ws3000.py

To get this running from Putty's CLI, I had to change into
PYTHONPATH=bin python /bin/user/ws3000.py

Result is that the execution stops at the first comment-line.
At least positive is that ws3000.py has been found and is executed.
Have taken out all comment lines from ws3000.py between """ and """
Then running
PYTHONPATH=bin python /bin/user/ws3000.py
=> result is an error report telling
  File "/bin/user/ws3000.py", line 17, in <module>
    import weewx.drivers
ImportError: No module named weewx.drivers

Then stopped, to write this response .....

Ton vanN

unread,
Feb 11, 2020, 5:36:05 PM2/11/20
to weewx-user
Olivier,

Perhaps the underlaying Linux_version makes a difference.
In my configuration it is Raspian_Buster_Lite.

Anton

Op dinsdag 11 februari 2020 22:29:08 UTC+1 schreef Ton vanN:

Ton vanN

unread,
Feb 11, 2020, 5:58:28 PM2/11/20
to weewx-user
Have checked the other Raspberries within my reach whether they have a folder /bin/user/
Result:
Raspian_Stretch => no folder /bin/user/
Raspian_Buster_Desktop => no folder /bin/user/

Op dinsdag 11 februari 2020 23:36:05 UTC+1 schreef Ton vanN:

gjr80

unread,
Feb 11, 2020, 6:00:04 PM2/11/20
to weewx-user
Your issue (to do with file locations) is due to the way in which WeeWX was installed. Installation via setup.py  results in WeeWX files being located in /home/weewx by default. Installation via a package results in the WeeWX files being spread over a number of different locations. Refer to Where to find things in the User's Guide.

Gary

Ton vanN

unread,
Feb 11, 2020, 6:19:26 PM2/11/20
to weewx-user
Gary,

Completely agree.
After the experiments, this evening checked the location of weewx-files, and that is 100% in accordance with http://www.weewx.com/docs/debian.htm
as could be expected, because the installation was also in accordance with that document.
Also at my Raspberry weewx_root is /

Probably it means that for&in ws3000.py some adaptations are required for alignment with those different locations, to enable installation of ws3000.py
In hindsight taking care of differences dependent on installation procedure:
a) as described in User Guide
b) via setup.py

Anton

Anton

Op woensdag 12 februari 2020 00:00:04 UTC+1 schreef gjr80:

Olivier Guyotot

unread,
Feb 12, 2020, 1:39:15 PM2/12/20
to weewx-user
If your installation was done using the Debian package manager, then you need to deploy the ws3000.py file in /usr/share/weewx/user.

And the command to run would presumably be:
PYTHONPATH=/usr/share/weewx python /usr/share/weewx/user/ws3000.py

Unfortunately I have no experience with this type of installation, and no way to test it. I won't be of much help here.

NOTE: I just noticed that in your configuration, you specified driver = user.hp3000. Unless you made a change, it should be driver = user.ws3000.
Where did you see this info?
Or otherwise formulated: where shal I put such line?
I saw that in the StdConvert issue thread, where you posted part of your weex.conf, didn't you?

What you need is a section such as:
[WS3000]
    # This section is for the Ambient Weather WS3000

    # The driver to use
    driver = user.ws3000

    # The station model, e.g., WS3000, WS3000-X3, WS3000-X5 (all the same...)
    model = WS3000

    # [Optional] USB read/write timeout (helps on Raspberry Pi)
    # Default is 1000
    timeout =  1000

The rest should be optional.



Ton vanN

unread,
Feb 13, 2020, 5:05:46 AM2/13/20
to weewx-user
@Olivier,
Changed the WeeWX-setup to the 'normal' configuration resulting after installation with the tar-file and setup.py.
At least the script ws3000.py now starts running, but not without errors: error report has been sent by Email.
Looking at the errorreports, apparently the version Python2.7 as part of Raspian_Buster is conflicting with functions in script ws3000.py

Op woensdag 12 februari 2020 19:39:15 UTC+1 schreef Olivier Guyotot:

Olivier Guyotot

unread,
Feb 13, 2020, 5:23:42 AM2/13/20
to weewx-user
In the file that you sent, the error is:
usb.core.USBError: [Errno 13] Access denied (insufficient permissions)

It looks like your user doesn't have access to the USB device. For testing, I would suggest to try as root instead. When it will work as root, you can then make it work with your normal user.

Ton vanN

unread,
Feb 13, 2020, 5:23:59 AM2/13/20
to weewx-user
Forgot to hint that RistoK's HowTo-Instructions for fitting the ws3000-driver on a Raspberry would have been very useful for my efforts (probably significantly reducing my questions and experiments), but unfortunately those instructions no longer accessible, because the hosting server has gone .......
Now smells a bit like 'reinventing the wheel', unless somebody can reproduce those instructions.

Op donderdag 13 februari 2020 11:05:46 UTC+1 schreef Ton vanN:

Ton vanN

unread,
Feb 13, 2020, 3:08:41 PM2/13/20
to weewx-user
Olivier has made the read-out of WS3000 an extension to 'another' weatherstation.
For just reading & processing the output of WS3000 a number of adaptation have to be made.

In my setup I have WeeWX operating with the Simulator which generates fake-weather.
On the other hand I have plenty of data from real weather-sensors.
That data is good enough to 'inject' into the Simulator, resulting in one merged data-set with all actual data.
Have looked around, but not seen in this Google-group, nor in WeeWX-wiki such a possibility.
Did I miss the info, or not yet developed?


Op donderdag 13 februari 2020 11:23:59 UTC+1 schreef Ton vanN:

Olivier Guyotot

unread,
Feb 13, 2020, 4:26:08 PM2/13/20
to weewx-user
Here, I put the code on github, with some basic installation instructions.
https://github.com/hublol/WS-3000_WeeWx

I haven't tested those instructions recently, they might be incomplete right now, but it's a start and I'll work to improve them if needed.

Ton vanN

unread,
Feb 13, 2020, 5:26:34 PM2/13/20
to weewx-user
Perhaps not 100% done according to Olivier's latest message, but got the same result in weewx.conf
Now (in the next days) an update for display & database .....

Op donderdag 13 februari 2020 22:26:08 UTC+1 schreef Olivier Guyotot:

Risto H. Kurppa

unread,
Feb 14, 2020, 1:02:38 AM2/14/20
to weewx...@googlegroups.com
Not sure if it helps anyone, but with Oliver's help about a year or so ago, I stripped the ws3000 weewx driver code to work as standalone, without needing weewx. That way I was able to just read the values to MQTT for further use, without weewx dependency. The code is not cleaned in any way and it's actually possible that it still uses some weewx things here or there- I still have also weewx installed and haven't tested it without weewx.

https://pastebin.com/37WkUz7N

Feel free to use & edit & expand. Or Olivier, maybe you want to add an standalone script to your github?

Risto



--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/qDe-El03C2k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
Message has been deleted

Ton vanN

unread,
Feb 14, 2020, 2:50:02 AM2/14/20
to weewx-user
Risto,

This script sure helps:
after stripping out the comments, it ran without errors at first try!
Seems quite a good starting point for my planned further effort in direction of Domoticz and for graphing with RRDTool.
Like you did, tested while weewx still around & active: therefore next to test that it runs without weewx
If not, to be checked whether it runs with weewx installed by the 'simple' method (spreading the files from /root).

Last week ;-) quickly learned a lot about weewx by try& error:
Olivier_G thanks for the continuous support for this NOOB!

My conclusion for first use of weewx:
the first installation of weewx makes the difference, but :-(  that is unknown for a first time user of weewx.
Perhaps a suggestion that in a description for an addition/modification for aspects such as the driver/interface for HP300x or WS3000 in one of the first comment lines it is clearly stated that an installation through setup.py is assumed, putting files in /home/weewx (or by the 'simple' method).
After I changed to use of setup.py, the scripts from both Matthewwall and Olivier_G started running.

Op vrijdag 14 februari 2020 07:02:38 UTC+1 schreef Risto H. Kurppa:
Not sure if it helps anyone, but with Oliver's help about a year or so ago, I stripped the ws3000 weewx driver code to work as standalone, without needing weewx. That way I was able to just read the values to MQTT for further use, without weewx dependency. The code is not cleaned in any way and it's actually possible that it still uses some weewx things here or there- I still have also weewx installed and haven't tested it without weewx.

https://pastebin.com/37WkUz7N

Feel free to use & edit & expand. Or Olivier, maybe you want to add an standalone script to your github?

Risto



On Fri, Feb 14, 2020 at 12:26 AM Ton vanN <ton...@gmail.com> wrote:
Perhaps not 100% done according to Olivier's latest message, but got the same result in weewx.conf
Now (in the next days) an update for display & database .....

Op donderdag 13 februari 2020 22:26:08 UTC+1 schreef Olivier Guyotot:
Here, I put the code on github, with some basic installation instructions.
https://github.com/hublol/WS-3000_WeeWx

I haven't tested those instructions recently, they might be incomplete right now, but it's a start and I'll work to improve them if needed.

--
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/qDe-El03C2k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx...@googlegroups.com.

Ton vanN

unread,
Feb 16, 2020, 2:38:02 AM2/16/20
to weewx-user

Fitted the stand-alone reader on an 'empty' Raspberry without weewx (just Raspian_Buster + latest Domoticz_beta).
In new folder /home/pi/Install-files
Slight name-change to match my system-configuration.

First result from Putty's CLI shown below.

pixx@raspberrypixx:~ $ sudo python /home/pi/Install_files/hp3001_reader_python_script.py
Traceback (most recent call last):
  File "/home/pi/Install_files/hp3001_reader_python_script.py", line 4, in <module>
    import usb.core
ImportError: No module named usb.core
More or less as expected the 'import'-section causes first trouble, calling modules not present.
Not further tested, expecting 'more of the same'. Seems to demonstrate that 'stand-alone' in this case is not 100%.

After installation on that machine of weewx in the 'basic' form according to the UserGuide, the result is as below (for my configuration):

pixx@raspberrypixx:~ $ sudo python /home/pi/Install_files/hp3001_reader_python_script.py
{'dateTime': 1581756586, 'extraHumid4': 88, 'extraHumid5': 88, 'extraHumid2': 54, 'extraHumid3': 88, 'extraHumid1': 56, 'extraTemp4': 11.4, 'extraTemp5': 11.4, 'extraTemp2': 16.8, 'extraTemp3': 11.3, 'usUnits': 17, 'extraTemp1': 17.2}
Looks good!
Probably simplest solution with least effort is installation of weewx before running of the reader-script:
installation may be, either 'basic', or via setup.py

Next questions
- the output of this script on Putty's CLI is recognized as a JSON-file
- reading a program from another programmer is not always easy.
Therefore the quick&easy requests to the programmer (Olivier?) for support of my views:
1. What is the line of the script with the print-command and the JSON-file-name for this output?
2. Output by the JSON-file now dynamically limited to data from valid sensors.
=> if a sensor goes down (such as 'battery empty'), then a different JSON-file.
For subsequent processing somewhat easier/simpler if 'empty' fields are still there.
How/where to change the script to get that?

Op vrijdag 14 februari 2020 08:50:02 UTC+1 schreef Ton vanN:

Ton vanN

unread,
Feb 16, 2020, 7:45:55 AM2/16/20
to weewx-user
Question 3, to have 'loose' coupling between this reader-script and any follow-on function.
Is it possible to add one or more lines for export/save of the JSON-file to a designated folder?

Op zondag 16 februari 2020 08:38:02 UTC+1 schreef Ton vanN:

Ton vanN

unread,
Feb 16, 2020, 8:01:27 AM2/16/20
to weewx-user
Is really a side-step and an indirect way,
but 'mis-using' weewx to create a weatherstation based on 'other data' (for example) can be realised via User's Guide · gjr80/weewx-xmlparse Wiki · GitHub
Main requirement seems that you have to compile a compatible XML-file from that 'other data'.

Op donderdag 13 februari 2020 21:08:41 UTC+1 schreef Ton vanN:

Olivier Guyotot

unread,
Feb 16, 2020, 11:41:20 AM2/16/20
to weewx-user
ImportError: No module named usb.core
 
usb.core is not a weewx module, this is a basic python one. What you need to do is not to install weewx, but rather to install the correct python dependencies.

Considering what you are trying to do, weewx doesn't seem to be the appropriate tool. You don't need it and shouldn't install it in the hope that it will fix your current problems.

I am not familiar with Domoticz, and I don't know how easily you can extend it to integrate you WS-3000. Personally I use Home Assistant, and I use the weewx extention to push the data to an influxdb database. So Home Assistant is not directly accessing the WS-3000, but I believe that this would be fairly easy to do.

You should try to do the same: either Domoticz can be extended to directly access the WS-3000, or you could use the stand alone script and push the data into a database that can be used by Domoticz.

In any case, I don't think that this is the right place to continue this discussion. You'll probably get much better support for what you are trying to do on the Domoticz forum.

Olivier Guyotot

unread,
Feb 16, 2020, 11:48:05 AM2/16/20
to weewx-user
ok, in fact I am getting very confused by what you are trying to do. Why do you want to mis-use weewx? And why use XML or JSON files, rather than a database?
And if the goal is to integrate the WS-3000 with Domoticz, can't this be done directly (by writing a plugin or add-on to Domoticz)?

Ton vanN

unread,
Feb 23, 2020, 3:16:12 AM2/23/20
to weewx-user
Olivier,

1. Use of JSON/XML
Why not a database or MQTT? Reason = 'history of System-concept'
Within my configuration I have a structure in which from various sources a set of JSON/XML-files is uploaded to a 'Central server', and all users can pick as they like:
some of these files are 'public' and used by external applications for remote access to (a piece of) my actual data.
Obvious then try to fit HP3001 in that structure.
;-) Although sure I should modernize (in parallel to the 'production') in the direction of MQTT etc.
2. 'Misuse' of WeeWX
My 2 PWSes (WS7000 + TFA_Nexus) have directly related software taking the interfaces of the sensors and applying the data for various purposes.
However, those 2 PWSes have weak elements. In my configuration also an amount of other sensors feeding to Domoticz.
Some of the weaknesses can be remedied by feeding alternative data from Domoticz, but the software mentioned above only allows limited 'correction'.
Therefore the idea to make with help of WeeWX-elements ;-) the '3rd & perfect PWS' compiled from the best dataset available in my configuration.

Meanwhile have inserted and tested some 'plugins' in the WS3000-readerscript in the vicinity of lines 380 ~ 390, for orientation in the following script-segment some existing lines before and aft the insertion.
Result is generation of a JSON-file and an XML-file put in folder /home/pi
From there an FTP-function (to be choosen by the User) picks the files and processes them for further applications, such as the upload to the mentioned 'Central Server'.

Geef de code hier op...
# Read datasets for new_packet
        nberrors
= 0
       
while nberrors < self.max_tries:
           
# Get a stream of raw packets, then convert them
           
try:
                read_sensors_command
= self.COMMANDS['sensor_values']
                raw_data
= self._get_raw_data(read_sensors_command)
# Convert data sets for new_packet
               
if not raw_data:  # empty record
                   
raise IOError("Failed to get any data from the station")
                formatted_data
= self._raw_to_data(raw_data, read_sensors_command)
                logdbg
('data: %s' % formatted_data)
                new_packet
= self._data_to_wxpacket(formatted_data)
                logdbg
('packet: %s' % new_packet)
# Make JSON-file
               
with open('/home/pi/HP3001_data.json', 'w') as outfile:
                    json
.dump(formatted_data, outfile)
# Make XML-file
                HP3001_xml
= dicttoxml.dicttoxml(new_packet, attr_type=False)
                xml_output
= open("/home/pi/HP3001_data.xml",'w')
                xml_output
.write(HP3001_xml)
                xml_output
.close()
# End of JSON/XML-Compilation
               
return new_packet




Op zondag 16 februari 2020 17:48:05 UTC+1 schreef Olivier Guyotot:

Ton vanN

unread,
Feb 23, 2020, 3:28:37 AM2/23/20
to weewx-user
Olivier,

Related to reading the WS3000/HP300x, have split the effort in 2 segments:
a) export of data from the WS3000-reader in a layout and to a location which can be accessed by the "User".
In my case either JSON-format, or XML-format.
This function seems best located at side of the Reader.
b) import of the data from a) to 'Users"of which Domoticz is one.
This function seems best located at side of each "User".

Op zondag 16 februari 2020 17:48:05 UTC+1 schreef Olivier Guyotot:
ok, in fact I am getting very confused by what you are trying to do. Why do you want to mis-use weewx? And why use XML or JSON files, rather than a database?

Ton vanN

unread,
Feb 23, 2020, 3:30:32 AM2/23/20
to weewx-user
Don't forget to add 2 linse at the start of the script!
import json
import dicttoxml

Op zondag 23 februari 2020 09:16:12 UTC+1 schreef Ton vanN:

Trachycarpus

unread,
Jul 12, 2020, 5:15:40 PM7/12/20
to weewx-user
Olivier Guyotot, Thanks for this driver, it works perfectly on the HP-3001!

Screenshot 2020-07-12 at 23.47.55.png

Screenshot 2020-07-12 at 23.48.56.png

Screenshot 2020-07-12 at 23.49.19.png



Screenshot 2020-07-12 at 23.49.52.png

Screenshot 2020-07-12 at 23.50.56.png

Screenshot 2020-07-12 at 23.51.36.png





вторник, 30 октомври 2018 г., 18:49:35 UTC+2, olivier...@gmail.com написа:
Here is an updated version of the driver, including:
- the fix for sub-zero temperatures
- improved error handling/retry (something that wasn't working properly before)
- the usb timeout is now a configuration setting
- additional comments

It probably won't fix the root cause of the 'crash' issue, but at least it should now properly retry so the problem might be more transparent. And the error reporting will be more useful to figure out what's wrong should an exception occur.

_ ka300m _

unread,
Oct 4, 2020, 12:57:32 PM10/4/20
to weewx-user
Hi all,
I have a Misol Hp-3001 too and after some logilc work on Oliver files I was able to convert them in python3 format (I don't know python language).

Now last version of weewx get date from my Station.

I'm writing you, specially to  Vladi, can you share skin/template or all is needed to have data publicated like your screenshot? 

Reply all
Reply to author
Forward
0 new messages