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.

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to