From: Stefano M. <mo...@ic...> - 2017-08-14 17:09:03
|
As far as I understand this is a limitation of the python OW module. In OWFS, “pages" is not a “file” but a “directory”: $ owdir /Alias2438/pages /Alias2438/pages/page.ALL /Alias2438/pages/page.0 /Alias2438/pages/page.1 /Alias2438/pages/page.2 /Alias2438/pages/page.3 /Alias2438/pages/page.4 /Alias2438/pages/page.5 /Alias2438/pages/page.6 /Alias2438/pages/page.7 $ owread /Alias2438/pages/page.0 | hexdump 0000000 6007 bd22 0701 0000 0000008 so '/Alias2438/pages/page.0' should be accessed as ‘spic.pages.page_0’ but this syntax for accessing “subdirectories” is not implemented in python-ow. Other more modern python bindings for OWCAPI exists in PyPi, but I have no experience running them: https://pypi.python.org/pypi/pyowfs/ <https://pypi.python.org/pypi/pyowfs/> https://pypi.python.org/pypi/onewire/0.2 <https://pypi.python.org/pypi/onewire/0.2> If you run owserver on your raspbian (which BTW is the recommended setup) then you could try pyownet: http://pyownet.readthedocs.io/en/latest/ <http://pyownet.readthedocs.io/en/latest/> (conflict of interest disclaimer: I’m the author of pyownet). Python 3.4.2 (default, Oct 19 2014, 13:31:11) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from pyownet.protocol import proxy >>> owp = proxy('localhost') >>> owp.read('/Alias2438/pages/page.0') b'\x07\x80"\xbd\x01\x07\x00\x00' Bye Stefano > On 13 Aug 2017, at 22:30, Gary Fariss <g4...@gi...> wrote: > > Hello... > > I'm using Peter Kropf's OWFS Python library (python-ow_2.9p8-6_armhf.deb) on my Raspbian Jessie system (sudo apt-get install python-ow). > > ** I'm having trouble accessing the memory of a DS2438 Smart Battery Monitor. > > > ** The "entryList function says "pages" is a valid attribute: > > spipc = ow.Sensor("Alias2438") > print spipc.entryList() > > ['B1-R1-A', 'CA', 'EE', 'HIH3600', 'HIH4000', 'HTM1735', 'IAD', 'MultiSensor', 'S3-R1-A', 'VAD', 'VDD', 'address', 'alias', 'crc8', 'date', 'disconnect', 'endcharge', 'family', 'humidity', 'id', 'locator', 'offset', 'pages', 'r_address', 'r_id', 'r_locator', 'temperature', 'type', 'udate', 'vis'] > > > ** But __getattr__ doesn't like the name: > > spipc = ow.Sensor("Alias2438") > print spipc.pages > > Traceback (most recent call last): > File "ospi_gc.py", line 278, in <module> > main() > File "ospi_gc.py", line 241, in main > print spipc.pages > File "/usr/lib/python2.7/dist-packages/ow/__init__.py", line 349, in __getattr__ > raise AttributeError, name > AttributeError: pages > > ** Can you tell me what's wrong? > > 73, > Gary > > > --- > This email has been checked for viruses by Avast antivirus software. > https://www.avast.com/antivirus > > > ------------------------------------------------------------------------------ > 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 > Owf...@li... > https://lists.sourceforge.net/lists/listinfo/owfs-developers |