> On 01 May 2016, at 22:12, Loren Amelang <lo...@pacific.net> wrote:
> 
> And...  I just noticed my test readings aren't quite the same! How can it be 
> that w1 shows "59 01 4b 46 7f ff 07 10 a2 t=21562" when the ownet proxy 
> returns "21.625"? And where does the proxy get "21.0625" if the raw data 
> returned by w1 is just "21062"? Curious...  

All the magic happens inside owserver, not pyownet…

The DS18B20 temperature register format is 12 bit, so “59 01 …” or “LSB MSB” is 
converted (by owserver) as 0x159 / 2**4 or 21.5625 

Notice that the least significant bit of the register is 2**-4 or 0.0625 °C 
which means that the w1 kernel readout (10**-3 °C) has not enough resolution to 
represent exactly the binary raw data. (But who cares about half a mK 
difference?)

As a side note:

if you upgrade to pyownet v0.9.0 or greater (latest version is v0.10.0) 
instantiating directly the OwnetProxy class is deprecated, use instead the 
factory function 
pyownet.protocol.proxy, 
http://pyownet.readthedocs.io/en/latest/protocol.html#pyownet.protocol.proxy

Your example should be 

import pyownet.protocol
proxy = pyownet.protocol.proxy()
...
       temp[0] = proxy.read('/uncached/28.884d88000000/temperature')
       temp[1] = proxy.read('/uncached/28.D64788000000/temperature')
 

or 

from pyownet.protocol import proxy as proxyfactory
proxy = proxyfactory()
…

or
… whatever you like better.


The reason for dropping the OwnetProxy class is that in recent versions 
persistent connections are supported (i.e. a single socket for more than one 
transaction) so that now there are two different types of proxy objects: 
persistent and non persistent ones, see 
http://pyownet.readthedocs.io/en/latest/protocol.html#persistent-vs-non-persistent-proxy-objects

Bye

S.

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to