Hello Joe,

please always send your mails to owfs-developers mailing list so that it gets 
distributed to its members also ...

Regarding your question:

the "28." part of the "id" is the sensor type (e.g. DS1820) and therefore not 
part of the 1wire id ...

.find() works very simple, it just tries to find a matching entry in the owfs 
tree hierarchy. if you take a look at the entries for a sensor in the 
webinterface (owhttpd) you find a parameter "id" and a corresponding value ... 
thats exactly what the .find() method tries to find ... 

so in theory you can also use it for finding a sensor which has a "temperature" 
entry with a given temperature ;)

sorry for the typos, i am currently writing from my mobile phone ;)

regards,
marcus.



joep <[email protected]> schrieb:

>Marcus,
>             I should be thanking you for making pyowfs available and 
>also answering my query.
>
>             Your code works for me. To tell you the full story I had 
>already tried something very similar. In your example you used:
>             s = c.find (id="4AEC29CDBAAB") [0]
>             s.get ("temperature")
>                 --> 14.1603
>
>             In my initial code I used:
>                s2 = root.find (id="28.450EDC020000") [0]
>                s2.get ("temperature")
>             and got:
>             " File "./temperature_pyowfs_1.py", line 23, in <module>
>              s2 = root.find (id="28.450EDC020000") [0]
>              IndexError: list index out of range" (This is the exact 
>error using my original code)
>
>             After reading your example I used:
>                s2 = root.find (id="450EDC020000") [0]
>                s2.get ("temperature")
>             and got:
>                 22.6875
>             which is correct.
>
>             The difference was that in my initial code I included the 
>"28." in the sensor ID key. My question now is: Why isn't the part 
>preceding the decimal point in the sensor ID included in the find() key
>?
>
>       BTW I got your reply to my question just after I had posted the 
>question to the forum (which I found using google). I'll see what comes
>
>back through the forum and then summarize your suggestions and any
>other 
>suggestions to the forum so that everyone is informed.
>
>         BTW (again) I'm putting together an environmental 
>monitoring\management system for my greenhouse and terrarium using 
>1-wire technology. The controller is a RaspberryPi. The application
>will 
>be developed in Python which I need to learn better than my current 
>understanding of it. Nothing like success to prod you towards your
>goals 
>and today I did have a success as I got the temperature monitoring 
>working as I required it. Good night (I'm writing from Australia and 
>it's now 23:20).
>
>-- 
>Regards
>Joe P.
>
>On 18/04/13 22:18, Marcus Priesch wrote:
>> Hello Joe,
>>
>> thanks for your interest in pyowfs ;)
>>
>> the .get() and .put() methods can only access attributes of a sensor
>> object (the leaves in the tree). To access a specific Sensor by id
>you
>> have to use the .find() method of the connection. Obviously you
>should
>> also check if the sensor actually could be found ...
>>
>> in my example i started a owserver with fake sensors in another
>> terminal:
>>
>> $ owserver --debug -p 4711 --fake=DS2409,DS18S20,DS1921
>>
>> to access a specific sensor i use the following:
>>
>>>>> from pyowfs import Connection
>>>>> c = Connection("localhost:4711")
>>>>> for s in c.find () :
>> ...  print s
>> ...
>> <Sensor /1F.67C6697351FF/ - DS2409>
>> <Sensor /10.4AEC29CDBAAB/ - DS18S20>
>> <Sensor /21.F2FBE3467CC2/ - DS1921>
>>>>> for s in c.find (id="67C6697351FF") :
>> ...  print s
>> ...
>> <Sensor /1F.67C6697351FF/ - DS2409>
>>>>> s
>> <Sensor /1F.67C6697351FF/ - DS2409>
>>>>> s = c.find (id="67C6697351FF") [0]
>>>>> s
>> <Sensor /1F.67C6697351FF/ - DS2409>
>>>>> s = c.find (id="4AEC29CDBAAB") [0]
>>>>> s.get ("temperature")
>> '     14.1603'
>>>>> s.get ("temperature")
>> '     60.6969'
>> The best place to post such questions is the owfs-developers list - i
>> posted this mail also there. see
>>
>> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>>
>> for details on how to access the achives and/or to subscribe
>>
>> all the best,
>> marcus.
>>
>> On Don, 2013-04-18 at 04:55 +0200, [email protected] wrote:
>>> Joseph F. Portell (Joe) sent a message using the contact form at
>>> http://priesch.co.at/contact.
>>>
>>> Marcus how can I directly assign a sensor with a specific ID (eg
>>> 28.450EDC020000) to a variable (type sensor) without having to
>iterate
>>> through all the sensors of a given type and parsing each item in the
>list for
>>> the sensor's ID? I tried to do things like s =
>root.get("/28.450EDC020000")
>>> but failed.
>>>
>>> Also what is the best forum to post these questions to?
>>>
>>> Thanks Joe P.
>>>
>>
>>

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to