see reply in green
Pascal
2010/4/6 Mick Sulley <[email protected]>
> Hi,
>
> Thanks to the help from Marcus and Pascal I am now able to read sensors
> on my network. Now the next question -
>
> I can run
>
> >>> root = Connection ("/dev/ttyD1")
> >>> s = root.find (type="DS18S20")[0]
> >>> print s
> <Sensor /10.0D54A9010800/ - DS18S20>
> >>> s.get("temperature")
> ' 19.125'
>
> and I read the temperature, but how can I read the temperature of a
> specific sensor? I get an error if I use
>
> >>> s = root.find (id="OD54A9010800")
>
I guess this would do better:
s = root.find (id="*10.0*D54A9010800")*[0]*
even if only one element is returned, the find returns a list, the [0] at
the end indicate that you select the first element.
if you are interested by getting temperatures from all your ds18s20,
something like this should do:
root = Connection ("/dev/ttyD1")
for s in root.find (type="DS18S20"):
s.get("id"),
s.get("temperature")
>>> s.get("temperature")
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> AttributeError: 'list' object has no attribute 'get'
> >>>
>
> Why is that? How can I read the temperature from a specific id?
>
> Thanks
>
> Mick
>
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Owfs-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>
--
Pascal
www.brain4home.eu
to subscribe, send a mail to <[email protected]>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers