Yes I would second that. It is a little ironic that in the owfs suite
of programs the module called owfs it the only one you really should not
use. Basically hte best way is to run owserver which talks to all the
devices, and then your python code talks to owserver.
I have been using pyownet since I dropped fuse, it really is very good,
documentation here https://pyownet.readthedocs.io/en/latest/
With python3 you need something like this -
import pyownet
DevAddress = 'enter your device address here'
owp = pyownet.protocol.proxy(persistent=True)
owp.write('/DevAddress/PIO.BYTE',b'0')
print('PIO.BYTE = ', owp.read('/uncached/DevAddress/PIO.BYTE')
print('sensed.BYTE = ', owp.read('/uncached/DevAddress/sensed.BYTE')
With Python3 the value ina write MUST be a byte value, hence b'0' in
that line, Python2 didn't seem to care, that threw me for a while.
Also from command line you can use the commands from ow-shell, so owdir
lists all devices, owread 28.A59F9D0B0000/latesttemp reads the value
from that device.
Hope that helps.
Mick
On 24/08/2020 16:47, Martin Patzak wrote:
For python I would highly recommend you use the library *pyownet *by
Stefano Miccoli
/https://github.com/miccoli/pyownet/
/using Fuse can lead to weird problems... (not saying that it is the
reason in your specific case)
or you can use the buil-in functions in owserver owread/owwrite/owdir
instead.
On 24.08.20 15:57, Dennis Putnam wrote:
I have the following python 3 code:
*fn='/mnt/1wire/3A.'+blower.id_+'/PIO.BYTE'**
**with open(fn,'wb') as fh:**
** fh.write(onOff.to_bytes(1,byteorder=sys.byteorder))
*This produces the error:
*OSError: [Errno 22] Invalid argument
*The value of onOff will be either 1 or 0. In this particular case
the value is 1. The value of blower.id_ is 0BE14D000000. This is what
that OWFS directory contains:
*ls -l /mnt/1wire/3A.0BE14D000000*
total 0
-r--r--r-- 1 root root 16 Aug 19 21:17 address
-rw-rw-rw- 1 root root 256 Aug 19 21:17 alias
-r--r--r-- 1 root root 2 Aug 19 21:17 crc8
-r--r--r-- 1 root root 2 Aug 19 21:17 family
-r--r--r-- 1 root root 12 Aug 19 21:17 id
-r--r--r-- 1 root root 16 Aug 19 21:17 locator
-rw-rw-rw- 1 root root 1 Aug 19 21:17 PIO.A
-rw-rw-rw- 1 root root 3 Aug 19 21:17 PIO.ALL
-rw-rw-rw- 1 root root 1 Aug 19 21:17 PIO.B
-rw-rw-rw- 1 root root 12 Aug 19 21:17 PIO.BYTE
-r--r--r-- 1 root root 16 Aug 19 21:17 r_address
-r--r--r-- 1 root root 12 Aug 19 21:17 r_id
-r--r--r-- 1 root root 16 Aug 19 21:17 r_locator
-r--r--r-- 1 root root 1 Aug 19 21:17 sensed.A
-r--r--r-- 1 root root 3 Aug 19 21:17 sensed.ALL
-r--r--r-- 1 root root 1 Aug 19 21:17 sensed.B
-r--r--r-- 1 root root 12 Aug 19 21:17 sensed.BYTE
-r--r--r-- 1 root root 32 Aug 19 21:17 type
I cannot see anything wrong with the code or permissions and the
error is so generic I don't know to what it refers. Can someone spot
what is invalid or help me debug this problem? TIA.
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers