Some time ago I wrote pyownet 
https://pyownet.readthedocs.io/en/latest/index.html 
<https://pyownet.readthedocs.io/en/latest/index.html> to overcome some 
limitations of the official packages.

The code is quite “stable” now, and does not have some of the fancy new 
features of trio-owfs (namely async i/o); however I think pyownet should be 
quite straightforward to use.

Some simple suggestion to getting started.

1) Forget python2 (which is pretty dead now): learn and use only python3.
2) Install owserver and owshell
3) First test your setup from a command window with the simple owshell commands 
(owdir, owread, owwrite…)
4) Install and activate a python virtual environment 
<https://docs.python.org/3/library/venv.html 
<https://docs.python.org/3/library/venv.html>>
5) `pip install pyownet`
6) start the python shell and do some experiments from the command prompt:

>>> import pyownet.protocol
>>> proxy = pyownet.protocol.proxy()
>>> proxy.dir()
['/26.xxxxx0010000/', '/26.yyyyy0010000/']
>>> proxy.read('/26.xxxxx0010000/temperature')
b'     28.3438'
>>> float(proxy.read('/26.xxxxx0010000/temperature'))
28.4062
>>> proxy.dir('/26.xxxxx0010000/‘)

>>> help(proxy.dir)
>>> proxy.dir(bus=True)
['/26.xxxxx0010000/', '/26.yyyyy0010000/', '/bus.0/', '/uncached/', 
'/settings/', '/system/', '/statistics/', '/structure/', '/simultaneous/']

It should be quite simple to replicate the owshell commands using the methods 
of the proxy object. 
Once you are familiar with the owfs structure and the pyownet commands you can 
start writing your first script.

Stefano


> On 20 May 2019, at 16:52, Nico Bouthoorn via Owfs-developers 
> <owfs-developers@lists.sourceforge.net> wrote:
> 
> Are there any python programmers?
> I can read a device with the python-ow pkg, but have any of you an example 
> python script  how to write to a ds2408 forexample?
> I'm a really a novice with python, perl is not a problem...
> 
> Thanks,
> 
> Nico
> 
> 
> 
> _______________________________________________
> 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

Reply via email to