pyownet
"pyownet is a pure python package that allows to access an owserver via the owserver network protocol, in short ownet. owserver is part of the OWFS 1-Wire File System."
More information :
https://pypi.python.org/pypi/pyownet
Python Interface zu OWFS. Mal schauen, wie man das gut einsetzen kann.
$ sudo pip install pyownet # installiert das Paket für Phyton 2. Es ist bei PyPi registriert.
$ sudo pip3 install pyownet # installiert das Paket für Phyton 3.
pyownet can be considered a replacement for ownet (which can be found in module/ownet/python in the owfs source tree). The main reason for writing this code was the observation that the ‘official' ownet has an incomplete set of features, it is not maintained anymore, and that there is no support for Python3.
Hier sind die Quellen : https://github.com/miccoli/pyownet.git
$ python # ruft python 2 auf
oder
$ python3
If there is an owserver listening at port 4304 of server.example.com, the use of pyownet is as simple as:
>>> from pyownet import protocol>>> owproxy = protocol.proxy(host="server.example.com", port=4304)
( oder >>> owproxy = protocol.proxy(host="127.0.0.1", port=4304) für eigenen Rechner )
>>> owproxy.dir() [u'/10.A7F1D92A82C8/', u'/05.D8FE434D9855/', u'/26.8CE2B3471711/']>>> owproxy.present('/10.A7F1D92A82C8/temperature') True>>> owproxy.read('/10.A7F1D92A82C8/temperature') ' 6.68422'
oder mit anderen Sensoren :
>>> owproxy.dir()
['/10.3F184C010800/', '/28.96E361010000/']
>>> owproxy.read('/10.3f184c010800/temperature')
bytearray(b' 21.5')
>>> owproxy.read('/28.96E361010000/temperature')
bytearray(b' 21.125')
Das Ganze funktioniert natürlich auch vom benachbarten Windows PC aus :
C:\Users\Ekki>C:\Users\Ekki\AppData\Local\Programs\Python\Python36-32\python.exe -m pip install pyownet
Collecting pyownet
Downloading pyownet-0.10.0-py3-none-any.whl
Installing collected packages: pyownet
Successfully installed pyownet-0.10.0
C:\Users\Ekki>
>>>
>>> from pyownet import protocol
>>> owproxy = protocol.proxy(host="192.168.178.30", port=4304)
>>> owproxy.dir()
['/10.3F184C010800/', '/28.96E361010000/']
>>> owproxy1 = protocol.proxy(host="192.168.178.80", port=4304)
>>> owproxy1.dir()
['/10.80FA4B010800/', '/10.12D054010800/', '/10.751455010800/', '/10.ED165501080
0/', '/10.D7F754010800/', '/28.38894B010000/', '/28.2AC661010000/', '/28.B5DE610
10000/', '/28.ADCE4B010000/', '/28.BDDC61010000/']
>>>