I do pass an instance around. I don't remember what exactly the application
was. I can revisit it, since it's on the emails.

C

On Wed, May 20, 2015 at 4:03 PM, Stefano Miccoli <mo...@icloud.com> wrote:

> Thanks Johan for your appreciation: but most of the merit does not go to
> the client (pyownet) but to the server (owserver). I’m really amazed how
> rock-solid owserver can be.
>
> Colin: the key point for using pyownet efficiently is to strictly have a
> single proxy instance for the whole program. Creating on the fly proxy
> instances and throwing them away after use is very inefficient.
>
> Here a quick and dirty timing on a raspberry pi-2 running debian jessie
> (only simulated devices, sorry, I have no access at home to a network of
> real sensors).
>
> >>> from pyownet.protocol import proxy
> >>> p = proxy()
> >>> float(p.read('/uncached/10.67C6697351FF/temperature'))
> 14.8957
> >>> float(open('/run/1wire/uncached/10.67C6697351FF/temperature').read())
> 75.7942
>
> >>> import timeit
>
> >>> setup = "import pyownet.protocol; p = pyownet.protocol.proxy()"
> >>> stmt = "t = float(p.read('/uncached/10.67C6697351FF/temperature'))"
> >>> timeit.repeat(stmt, setup, number=1000)
> [1.426529735999793, 1.430095917000017, 1.4105863439999666]
>
> >>> setup = "import pyownet.protocol; p =
> pyownet.protocol.proxy(persistent=True)"
> >>> stmt = "t = float(p.read('/uncached/10.67C6697351FF/temperature'))"
> >>> timeit.repeat(stmt, setup, number=1000)
> [0.9204462379998404, 0.8786001309999847, 0.8915852740001355]
>
> >>> stmt = "t =
> float(open('/run/1wire/uncached/10.67C6697351FF/temperature').read())"
> >>> timeit.repeat(stmt, number=1000)
> [2.3116189530001066, 2.300803404999897, 2.280824553000002]
>
> >>> setup = "import pyownet.protocol"
> >>> stmt = "p = pyownet.protocol.proxy()"
> >>> timeit.repeat(stmt, setup, number=1000)
> [5.222551192000083, 5.203011117999722, 5.198920875000113]
>
> So here I read a temperature from a simulated device, convert it to float
> and store it. Times are as follows:
>
> pyownet non persistent: 1.41 ms
> pyownet persistent: 0.88 ms
> owfs read: 2.28 ms
>
> These are really small times (reading a real sensor would take for sure
> longer), but nevertheless I do not expect that pyownet should be any slower
> than owfs access. Note however that creating a proxy instance takes about
> 5.2 ms so this operation should be done only once in the lifetime of the
> program.
>
> Stefano
>
>
> On 20 May 2015, at 09:47, Colin Reese <colin.re...@gmail.com> wrote:
>
>  Interesting data point, and makes me want to take another look. I have
> both implementations written up and ended up using os.walk on owfs dir as I
> found it fastest, despite having to write more code around it (obviously).
>
> Colin
>
>
> On 5/20/2015 12:26 AM, Johan Ström wrote:
>
> Hi,
>
> just want to give +1 for pyownet. I'm using it for my network and it works
> 100% flawless, scanning the alarm dir ~10 times per second and the full bus
> every 30 second, reading ~25 temperature sensors every 30 seconds.
>
> This have been running for about a year now, using my own master software
> which was designed for a mixed network with slow but powered temperature
> sensors and "quick" PIO-devices (such as DS2406), where it is important to
> service any PIO input changes quickly (alarm + latch):
> https://github.com/stromnet/pyowmaster
>
> I have not yet tested the socket persistence though, that is on my
> todo-list!
>
> Johan
>
> On 20/05/15 09:16, Stefano Miccoli wrote:
>
> Let me answer to the python part of your question.
>
>  To access 1-wire sensors from a python script you have two options:
>
>  A) install the owserver daemon and access 1-wire data via the owserver
> protocol (aka ownet), see http://owfs.org/index.php?page=owserver-protocol
> B) directly access the “physical bus” from your script.
>
>  Let discuss the two approaches.
>
>
>  *A) access via owserver.*
>
>  The owserver protocol is a TCP network protocol. In python you can use
> either a pure python implementation, or link to an external C library that
> implements the protocol.
>
>  As what regards pure python there are two options:
>
>
>    - ownet from the official distribution
>    - pyownet, available on pypi https://pypi.python.org/pypi/pyownet (pip
>    install pyownet) with docs here:
>    http://pyownet.readthedocs.org/en/latest/#
>
>
>  (I wrote pyownet to improve the official implementation, which is not
> more maintained on pipy where it stuck at version 0.2 of 2006-12-15)
>
>  Alternatively you can go for a binary library binding, which will
> introduce a run time dependency to libow
>
>
>    - ow from the official distribution
>    - pyowfs, available on pypi https://pypi.python.org/pypi/pyowfs (pip
>    install pyowfs) with docs here: http://priesch.co.at/pyowfs
>
>
>
>  In the case of the owserver protocol I would suggest using one of the
> two pure python implementations: bottleneck is usually the 1-wire bus, so
> there is no need to go to a C implementation of the TCP protocol.
> Performance is fairly good with both ownet and pyownet, with a slight edge
> on pyownet, with implements socket persistence and is actively maintained.
> (OK, this is the developer view.)
>
>
>  *B) direct access to the bus.*
>
>  This is not possible with pure python so you have to go with one of the
> two C API bindings (the official ow or pyowfs). I have no experience with
> this approach (I always install owserver first) so I can’t give informed
> advice. However I would first try pyowfs since it is maintained on pypi.
>
>
>
>  Bye
>
>  Stefano
>
>  On 20 May 2015, at 00:49, DavidJ61 <davejohn...@gmail.com> wrote:
>
> Further to my above message, I am having a bit of a problem accessing the
> pressure attribute for the EDS environment sensor EDS0066.  I have trawled
> google and am not able to find any documentation on how I can do this. In
> fact, as a whole, I have found this to be the case with owpython and it
> seems I am missing my crystal ball.
> I'd appreciate a bit of help and guidance.
>
>
>
> --
> View this message in context:
> http://owfs-developers.1086194.n5.nabble.com/owpython-tp5410p11354.html
> Sent from the OWFS Developers mailing list archive at Nabble.com
> <http://nabble.com/>.
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Owfs-developers mailing list
> Owfs-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>
>
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM 
> Insight.http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>
>
>
> _______________________________________________
> Owfs-developers mailing 
> listOwfs-developers@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/owfs-developers
>
>
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM 
> Insight.http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>
>
>
> _______________________________________________
> Owfs-developers mailing 
> listOwfs-developers@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/owfs-developers
>
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Owfs-developers mailing list
> Owfs-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>
>
>
>
> ------------------------------------------------------------------------------
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Owfs-developers mailing list
> Owfs-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>
>
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to