AFAIK it is not possible in OW-Python to access “subdirectories”. 

You can try pyownet, http://pyownet.readthedocs.io/en/latest/ which I wrote to 
overcome this limitation:

#! /usr/bin/env python2

from pyownet import protocol

owp = protocol.proxy('localhost', 4304)

for sensor in owp.dir():
    if owp.read(sensor + 'type') != 'BAE':
        continue
    print sensor, owp.read(sensor + 'version'), owp.read(sensor + '910/count')


(BTW if this is a new project, I would suggest using python3 instead of python2)

Stefano
    


> On 14 Sep 2017, at 22:32, Paul Everett <rep...@repton.org> wrote:
> 
> I am trying for a customer to work out how to get OW-Python to work with a 
> BAE0910 chip from Brain4Home.
> 
> I've never used python before but have some example code that I can use to 
> read from OWFS, the problem that I'm encountering is that I can't work out 
> the correct syntax to read data from a subfolder as most of the stuff on the 
> BAE0910 is in /FC.whatever/910/ rather than just in /FC.whatever/.
> 
> For example the following code will look on the network and report the 
> firmware versions of any BAE chips it finds:
> 
> #! /usr/bin/env python
> 
> import sys
> import ow
> 
> ow.init( 'localhost:4304' )
> 
> root = ow.Sensor( '/' )
> for sensor in root.find( type = 'BAE' ):
>        print sensor._path, sensor.version
> 
> However I can't work out what to put in place of "sensor.version" if instead 
> of /version I wish to read (for example) /910/count.
> 
> Can anyone help?
> 
> TIA,
> Paul
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Owfs-developers mailing list
> Owfs-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owfs-developers


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to