Try:
print getattr(s,'counters_A') or
print s.counters_A
Periods in attribute names get replaced by underscores in ownet.
Not sure where (if) it's documented, perhaps in the source someplace,
but
that's the rule.
Paul
On Mar 25, 2007, at 6:29 AM, Matt wrote:
>
> Well spotted and I briefly hoped that would be be the answer, but
> sadly
> not so.
> The python example, does use the wrong ID but even with the correct ID
> it fails.
>
> Interestingly 1D.438101000000 has vanish from the bus.
>
> George M. Zouganelis wrote:
>> it may sound sily, but in your examples you are reading a different
>> counter-chip in each case. Is it ok ?
>>
>> Matt wrote on 25/3/2007 11:41:
>>> Hi all,
>>>
>>> I'm tinkering around with ownet in python (which I like very much,
>>> bravo), and I have a situation I don't understand.
>>>
>>> I'm trying to read a rain gauge which is a counter, connected via
>>> usb
>>> to a nslu2 (owserver 2.6p2)
>>>
>>> From a Debian Etch machine (owread 2.6p0)
>>>
>>> /opt/owfs/bin/owdir -s 10.0.0.10:3002 /1D.F8B405000000/
>>> /1D.F8B405000000/address
>>> /1D.F8B405000000/counters.ALL
>>> /1D.F8B405000000/counters.A
>>> /1D.F8B405000000/counters.B
>>> /1D.F8B405000000/crc8
>>> /1D.F8B405000000/family
>>> /1D.F8B405000000/id
>>> /1D.F8B405000000/locator
>>> /1D.F8B405000000/memory
>>> /1D.F8B405000000/mincount
>>> /1D.F8B405000000/pages
>>> /1D.F8B405000000/present
>>> /1D.F8B405000000/r_address
>>> /1D.F8B405000000/r_id
>>> /1D.F8B405000000/r_locator
>>> /1D.F8B405000000/type
>>>
>>> and...
>>>
>>> /opt/owfs/bin/owread -s 10.0.0.10:3002 /1D.F8B405000000/counters.A
>>> 206666
>>>
>>> That works fine.
>>> From python on the same machine
>>>
>>>>>> import ownet
>>>>>> s=ownet.Sensor("1D.438101000000","10.0.0.10",3002)
>>>>>> print getattr(s,'counters.A')
>>> Traceback (most recent call last):
>>> File "<stdin>", line 1, in ?
>>> File "usr/lib/python2.4/site-packages/ownet/__init__.py", line
>>> 254,
>>> in __getattr__
>>> AttributeError: counters.A
>>>
>>> furthermore..
>>>
>>>>>> print s._attrs
>>> {}
>>>
>>>
>>> Any ideas ?
>>>
>>> Thanks
>>>
>>> Matt
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers