Python Access to ow-shell

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Python Access to ow-shell

Mick Sulley
Looking at converting my current Python code from owfs to ow-shell.  I
have found a few different Python bindings, any opinions on which one to
use?  Also there does not seem to be much documentation on any of them,
can anyone point me in the right direction?

Thanks

Mick


------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell

Johan Ström-3
On 27/07/16 21:26, Mick Sulley wrote:
> Looking at converting my current Python code from owfs to ow-shell.  I
> have found a few different Python bindings, any opinions on which one to
> use?  Also there does not seem to be much documentation on any of them,
> can anyone point me in the right direction?

I use pyownet (https://pypi.python.org/pypi/pyownet) with great success.
The author Stefano Miccoli is active on this list too, which is a big
plus :)


Johan

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell

Mick Sulley
Thanks for the suggestion Johan.  I had a quick look and this seems to
create a Python binding for owfs rather than owshell.  Is that correct?  
In his mail 24/7/2016 Jan Kandziora <[hidden email]> explained that owshell
is a better way to access the system than owfs, do these same
limitations apply to pyownet?

Thanks

Mick

On 27/07/16 20:31, Johan Ström wrote:

> On 27/07/16 21:26, Mick Sulley wrote:
>> Looking at converting my current Python code from owfs to ow-shell.  I
>> have found a few different Python bindings, any opinions on which one to
>> use?  Also there does not seem to be much documentation on any of them,
>> can anyone point me in the right direction?
> I use pyownet (https://pypi.python.org/pypi/pyownet) with great success.
> The author Stefano Miccoli is active on this list too, which is a big
> plus :)
>
>
> Johan
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Owfs-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers


------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell

Johan Ström-3


On 27/07/16 22:02, Mick Sulley wrote:
> Thanks for the suggestion Johan.  I had a quick look and this seems to
> create a Python binding for owfs rather than owshell.  Is that correct?
> In his mail 24/7/2016 Jan Kandziora <[hidden email]> explained that owshell
> is a better way to access the system than owfs, do these same
> limitations apply to pyownet?
pyownet is actually even better, as it communicates directly with owserver.
If you'd be using some owshell wrapper from your python code, you would
have to run an executable (i.e. execute "owread" or "owdir", which THEN
connects to owserver) for *every* *single* read/write/dir. Very inefficient.

> Thanks
>
> Mick
>
> On 27/07/16 20:31, Johan Ström wrote:
>> On 27/07/16 21:26, Mick Sulley wrote:
>>> Looking at converting my current Python code from owfs to ow-shell.  I
>>> have found a few different Python bindings, any opinions on which one to
>>> use?  Also there does not seem to be much documentation on any of them,
>>> can anyone point me in the right direction?
>> I use pyownet (https://pypi.python.org/pypi/pyownet) with great success.
>> The author Stefano Miccoli is active on this list too, which is a big
>> plus :)
>>
>>
>> Johan
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Owfs-developers mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Owfs-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers


------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell

Jan Kandziora
In reply to this post by Mick Sulley
Am 27.07.2016 um 22:02 schrieb Mick Sulley:
> Thanks for the suggestion Johan.  I had a quick look and this seems to
> create a Python binding for owfs rather than owshell.  Is that correct?
> In his mail 24/7/2016 Jan Kandziora <[hidden email]> explained that owshell
> is a better way to access the system than owfs, do these same
> limitations apply to pyownet?
>
I think I have to clarify the confusion.

Our whole toolbox is called OWFS. This includes owfs/fuse, owserver,
owshell, and the various language bindings included. It's called OWFS
because owfs/fuse was first. "ABC bindings for owfs" doesn't mean the
bindings are going to use the fuse interface (with its serious limitations).

The language bindings included in the OWFS toolbox either use OWlib, the
underlying driver library, directly. This enables you to create
stand-alone binaries without an owserver running. But owlib also *MAY*
use owserver. Owlib can do it all.

Or they use the owserver protocol, either through the general OWnet API
(the owshell tools do it that way) or through a homebrewn solution. It's
socket communication and the protocol is simple enough to do it all on
your own. You need to run an owserver to use this method.

The language bindings outside the OWFS toolbox all use the owserver
protocol, as far as I know.



The recommended method to use owfs is through owserver. It gives you a
good abstraction of the driver, much better than using OWlib directly.


Kind regards

        Jan

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell

joep
In reply to this post by Mick Sulley
Hi Mick,

     I've been using the PYOWFS library to communicate to the OWFS
network via an OWSERVER for around 5 years. Never had any issues and I
ran it in at least 3 different environments - an Intel based PC, an
iBook G4 (ie a Mac) running Debian - this is still in operation, and 2
RaspberryPi's. If I have time, someday, I'll try OWNET. Not sure if
anyone has compared PYOWFS with OWNET. Be interested knowing the pros
and cons.

Regards
Joe P.

On 28/07/16 05:26, Mick Sulley wrote:

> Looking at converting my current Python code from owfs to ow-shell.  I
> have found a few different Python bindings, any opinions on which one to
> use?  Also there does not seem to be much documentation on any of them,
> can anyone point me in the right direction?
>
> Thanks
>
> Mick
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Owfs-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>


------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell

joep
In reply to this post by Jan Kandziora
Hi Jan,

             Thanks for your usual clear explanation. Is what you said
documented somewhere in one spot? I remember when I first started using
OWFS (several years ago) struggling with trying to understand how all
the components in OWFS are related. I believe I constructed my
understanding form various sources on the net and by trial-and-error.
Could be a bit frustrating.

Regards
Joe P.

On 28/07/16 06:55, Jan Kandziora wrote:

> Am 27.07.2016 um 22:02 schrieb Mick Sulley:
>> Thanks for the suggestion Johan.  I had a quick look and this seems to
>> create a Python binding for owfs rather than owshell.  Is that correct?
>> In his mail 24/7/2016 Jan Kandziora <[hidden email]> explained that owshell
>> is a better way to access the system than owfs, do these same
>> limitations apply to pyownet?
>>
> I think I have to clarify the confusion.
>
> Our whole toolbox is called OWFS. This includes owfs/fuse, owserver,
> owshell, and the various language bindings included. It's called OWFS
> because owfs/fuse was first. "ABC bindings for owfs" doesn't mean the
> bindings are going to use the fuse interface (with its serious limitations).
>
> The language bindings included in the OWFS toolbox either use OWlib, the
> underlying driver library, directly. This enables you to create
> stand-alone binaries without an owserver running. But owlib also *MAY*
> use owserver. Owlib can do it all.
>
> Or they use the owserver protocol, either through the general OWnet API
> (the owshell tools do it that way) or through a homebrewn solution. It's
> socket communication and the protocol is simple enough to do it all on
> your own. You need to run an owserver to use this method.
>
> The language bindings outside the OWFS toolbox all use the owserver
> protocol, as far as I know.
>
>
>
> The recommended method to use owfs is through owserver. It gives you a
> good abstraction of the driver, much better than using OWlib directly.
>
>
> Kind regards
>
> Jan
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Owfs-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>


------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell

Jan Kandziora
Am 27.07.2016 um 23:34 schrieb joep:
> Hi Jan,
>
>              Thanks for your usual clear explanation. Is what you said
> documented somewhere in one spot? I remember when I first started using
> OWFS (several years ago) struggling with trying to understand how all
> the components in OWFS are related. I believe I constructed my
> understanding form various sources on the net and by trial-and-error.
> Could be a bit frustrating.
>
The current website at http://owfs.org can be a confusing, as it doesn't
go for the big picture. It's tiny little details mostly.

I'm sure it's all in there but I'm also sure not in one spot.

Kind regards

        Jan




------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell

joep
Jan,

     I agree. It is not "Top-Down" - first the architectural overview,
then down to the next level (for example an overall of the major
components). Not sure why it is like it is - maybe historically OWFS
development followed a "Bottom-Up" approach and that's what's
documented. Must admit that this is the path I follow when I start doing
new things - first the components then the architecture. This fact may
be useful to newcomers as they may think they are doing something when
they don't get it right away - it certainly challenged me.

Regards
Joe P.

On 28/07/16 08:56, Jan Kandziora wrote:

> Am 27.07.2016 um 23:34 schrieb joep:
>> Hi Jan,
>>
>>               Thanks for your usual clear explanation. Is what you said
>> documented somewhere in one spot? I remember when I first started using
>> OWFS (several years ago) struggling with trying to understand how all
>> the components in OWFS are related. I believe I constructed my
>> understanding form various sources on the net and by trial-and-error.
>> Could be a bit frustrating.
>>
> The current website at http://owfs.org can be a confusing, as it doesn't
> go for the big picture. It's tiny little details mostly.
>
> I'm sure it's all in there but I'm also sure not in one spot.
>
> Kind regards
>
> Jan
>
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Owfs-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>


------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell

Stefano Miccoli
In reply to this post by Mick Sulley
Shameless self-promotion: you should use pyownet, which is documented at http://pyownet.readthedocs.io/en/latest/

If you already have an owserver running on your localhost you can start with

$ pip install pyownet
$ python
>>> from pyownet.protocol import proxy
>>> owp = proxy(host='localhost')
>>> owp.dir()
['/10.000010EF0000/', '/05.000005FA0100/', '/26.000026D90200/', '/01.000001FE0300/', '/43.000043BC0400/']
>>> float(owp.read('/26.000026D90200/temperature'))
4.0

The idea is to have a proxy object, whose methods correspond to the ownet operations (dir, read, write, ping, present, etc.) Calls to the proxy methods are lightweight, while creation of the proxy object is a little more costly, so please resiste to the temptation of calling

pyownet.protocol.proxy().dir()

but always create  a proxy object at program initialisation and reuse it throughout your script.

Stefano

> On 27 Jul 2016, at 21:26, Mick Sulley <[hidden email]> wrote:
>
> Looking at converting my current Python code from owfs to ow-shell.  I
> have found a few different Python bindings, any opinions on which one to
> use?  Also there does not seem to be much documentation on any of them,
> can anyone point me in the right direction?
>
> Thanks
>
> Mick
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Owfs-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers


------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell

Mick Sulley
Thanks Stefano, I will give it try.  I am also reassured that I know who
to come to with questions as well :-)

Mick

On 28/07/16 10:50, Stefano Miccoli wrote:

> Shameless self-promotion: you should use pyownet, which is documented at http://pyownet.readthedocs.io/en/latest/
>
> If you already have an owserver running on your localhost you can start with
>
> $ pip install pyownet
> $ python
>>>> from pyownet.protocol import proxy
>>>> owp = proxy(host='localhost')
>>>> owp.dir()
> ['/10.000010EF0000/', '/05.000005FA0100/', '/26.000026D90200/', '/01.000001FE0300/', '/43.000043BC0400/']
>>>> float(owp.read('/26.000026D90200/temperature'))
> 4.0
>
> The idea is to have a proxy object, whose methods correspond to the ownet operations (dir, read, write, ping, present, etc.) Calls to the proxy methods are lightweight, while creation of the proxy object is a little more costly, so please resiste to the temptation of calling
>
> pyownet.protocol.proxy().dir()
>
> but always create  a proxy object at program initialisation and reuse it throughout your script.
>
> Stefano
>
>> On 27 Jul 2016, at 21:26, Mick Sulley <[hidden email]> wrote:
>>
>> Looking at converting my current Python code from owfs to ow-shell.  I
>> have found a few different Python bindings, any opinions on which one to
>> use?  Also there does not seem to be much documentation on any of them,
>> can anyone point me in the right direction?
>>
>> Thanks
>>
>> Mick
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Owfs-developers mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Owfs-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers


------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell - problem!

Mick Sulley
In reply to this post by Stefano Miccoli
Setfano, or anyone else who can help.

I installed pyownet and got it working and I have been developing my
code for several days, but this evening it has stopped working.  I have
gone back to your basic instructions and this is what I see -

control@pi-test:~ $ python
Python 2.7.9 (default, Mar  8 2015, 00:52:26)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> from pyownet.protocol import proxy
 >>> owp = proxy(host='localhost')
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/local/lib/python2.7/dist-packages/pyownet/protocol.py",
line 729, in proxy
     raise ConnError(*lasterr)
pyownet.protocol.ConnError: [Errno 111] Connection refused
 >>>


It happened after I restarted the server with

sudo service owserver restart

I have rebooted since but it is still the same.  Any idea what the
problem may be?

Thanks
Mick



On 28/07/16 10:50, Stefano Miccoli wrote:

> Shameless self-promotion: you should use pyownet, which is documented at http://pyownet.readthedocs.io/en/latest/
>
> If you already have an owserver running on your localhost you can start with
>
> $ pip install pyownet
> $ python
>>>> from pyownet.protocol import proxy
>>>> owp = proxy(host='localhost')
>>>> owp.dir()
> ['/10.000010EF0000/', '/05.000005FA0100/', '/26.000026D90200/', '/01.000001FE0300/', '/43.000043BC0400/']
>>>> float(owp.read('/26.000026D90200/temperature'))
> 4.0
>
> The idea is to have a proxy object, whose methods correspond to the ownet operations (dir, read, write, ping, present, etc.) Calls to the proxy methods are lightweight, while creation of the proxy object is a little more costly, so please resiste to the temptation of calling
>
> pyownet.protocol.proxy().dir()
>
> but always create  a proxy object at program initialisation and reuse it throughout your script.
>
> Stefano
>
>> On 27 Jul 2016, at 21:26, Mick Sulley <[hidden email]> wrote:
>>
>> Looking at converting my current Python code from owfs to ow-shell.  I
>> have found a few different Python bindings, any opinions on which one to
>> use?  Also there does not seem to be much documentation on any of them,
>> can anyone point me in the right direction?
>>
>> Thanks
>>
>> Mick
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Owfs-developers mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/owfs-developers
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Owfs-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers


------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell - problem!

Jan Kandziora
Am 03.08.2016 um 23:43 schrieb Mick Sulley:
> pyownet.protocol.ConnError: [Errno 111] Connection refused
>  >>>
>
This is an error from deep down the operating system. It means there is
no listener for your call. Specific for pyownet, the call to owserver.


>
> It happened after I restarted the server with
>
> sudo service owserver restart
>
> I have rebooted since but it is still the same.  Any idea what the
> problem may be?
>
Check whether owserver is running, and which socket parameters it is using.

Kind regards

        Jan

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell - problem!

Mick Sulley
No, owserver was not running, and I can't start it

control@pi-test:~ $ owserver --debug
DEBUG MODE
libow version:
     3.1p1
   DEBUG: ow_daemon.c:(170) main thread id = 1996423696
   DEBUG: ow_inotify.c:(80) No configuration files to monitor
CONNECT: ow_dnssd.c:(81) Zeroconf/Bonjour is disabled since dnssd
library isn't found
    CALL: ow_parsename.c:(104) path=[]
   DEBUG: owlib.c:(77) Global temp limit 0C to 100C (for fake and mock
adapters)
DEFAULT: owlib.c:(52) No valid 1-wire buses found
   DEBUG: ow_exit.c:(17) Exit code = 1
    CALL: ow_lib_close.c:(21) Starting Library cleanup
    CALL: ow_lib_stop.c:(22) Clear Cache
   DEBUG: ow_cache.c:(295) Flipping cache tree (purging timed-out data)
   DEBUG: ow_cache.c:(313) flip cache. tdestroy() will be called.
   DEBUG: ow_cache.c:(295) Flipping cache tree (purging timed-out data)
   DEBUG: ow_cache.c:(313) flip cache. tdestroy() will be called.
    CALL: ow_lib_stop.c:(24) Closing input devices
    CALL: ow_lib_stop.c:(26) Closing output devices
    CALL: ow_lib_stop.c:(28) Clearing compiled expressions
   DEBUG: ow_regex.c:(129) Regex destroy done
    CALL: ow_lib_close.c:(42) Finished Library cleanup
   DEBUG: ow_lib_close.c:(50) Libraries closed
control@pi-test:~ $

Any idea what the problem is?


On 03/08/16 23:47, Jan Kandziora wrote:

> Am 03.08.2016 um 23:43 schrieb Mick Sulley:
>> pyownet.protocol.ConnError: [Errno 111] Connection refused
>>   >>>
>>
> This is an error from deep down the operating system. It means there is
> no listener for your call. Specific for pyownet, the call to owserver.
>
>
>> It happened after I restarted the server with
>>
>> sudo service owserver restart
>>
>> I have rebooted since but it is still the same.  Any idea what the
>> problem may be?
>>
> Check whether owserver is running, and which socket parameters it is using.
>
> Kind regards
>
> Jan
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Owfs-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers


------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell - problem!

Jan Kandziora
Am 04.08.2016 um 01:09 schrieb Mick Sulley:
> No, owserver was not running, and I can't start it
>
> control@pi-test:~ $ owserver --debug
>
> [...]
>
> Any idea what the problem is?
>
You haven't specified any host adapter nor a configuration file on the
command line.

Kind regards

        Jan

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell - problem!

Mick Sulley
Ahh!  OK if I start it as

owserver -c /etc/owfs.conf

it runs. So I tried a reboot and now it is running again, started
automatically at boot.

I am confused, but at least it is working again.

Once again, many thanks Jan.


On 04/08/16 02:12, Jan Kandziora wrote:

> Am 04.08.2016 um 01:09 schrieb Mick Sulley:
>> No, owserver was not running, and I can't start it
>>
>> control@pi-test:~ $ owserver --debug
>>
>> [...]
>>
>> Any idea what the problem is?
>>
> You haven't specified any host adapter nor a configuration file on the
> command line.
>
> Kind regards
>
> Jan
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Owfs-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers


------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Python Access to ow-shell - problem!

Stefano Miccoli
In reply to this post by Mick Sulley
As already pointed out by Jan, 

the
pyownet.protocol.ConnError: [Errno 111] Connection refused
exception (see http://pyownet.readthedocs.io/en/latest/protocol.html#pyownet.protocol.ConnError ) simply wraps the underlying OS error code, which in this case was 111 or ECONNREFUSED. Typically this means that nobody is listening on the host/port you specified within the proxy() function and this is a symptom of a dead owserver process.

For debugging this situation you can issue

$ netstat -tl

and confirm that there is no active process listening on localhost:4304 (or *:4304). (You can also ‘sudo netstat -tlp’ if you are looking for specific info on which process is listening on which port.)

As what regards starting/restarting the owserver process, unfortunately Debian has adopted systemd as its init system, although a lot of systemV inits scripts are still around. You should therefore use the systemd command

$ sudo systemctl restart  owserver.service

instead of the systemV command ‘service’ which works only for systemV init.d scripts. 

Debugging init systems is black magic, but here is a list (in random order) of commands that I use. (prepend sudo if you are not root)

$ systemctl stop owserver.service; systemctl start owserver.service # which sometimes is different from a plain systemctl restart
$ systemctl status owserver.service
$ killall owserver # sometimes the init scripts fails to stop running services
$ killall -KILL owserver
$ netstat -tlp
$ journalctl -e

and so on.

S.


On 03 Aug 2016, at 23:43, Mick Sulley <[hidden email]> wrote:

Setfano, or anyone else who can help.

I installed pyownet and got it working and I have been developing my
code for several days, but this evening it has stopped working.  I have
gone back to your basic instructions and this is what I see -

control@pi-test:~ $ python
Python 2.7.9 (default, Mar  8 2015, 00:52:26)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
from pyownet.protocol import proxy
owp = proxy(host='localhost')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/pyownet/protocol.py",
line 729, in proxy
    raise ConnError(*lasterr)
pyownet.protocol.ConnError: [Errno 111] Connection refused



It happened after I restarted the server with

sudo service owserver restart

I have rebooted since but it is still the same.  Any idea what the
problem may be?

Thanks
Mick



On 28/07/16 10:50, Stefano Miccoli wrote:
Shameless self-promotion: you should use pyownet, which is documented at http://pyownet.readthedocs.io/en/latest/

If you already have an owserver running on your localhost you can start with

$ pip install pyownet
$ python
from pyownet.protocol import proxy
owp = proxy(host='localhost')
owp.dir()
['/10.000010EF0000/', '/05.000005FA0100/', '/26.000026D90200/', '/01.000001FE0300/', '/43.000043BC0400/']
float(owp.read('/26.000026D90200/temperature'))
4.0

The idea is to have a proxy object, whose methods correspond to the ownet operations (dir, read, write, ping, present, etc.) Calls to the proxy methods are lightweight, while creation of the proxy object is a little more costly, so please resiste to the temptation of calling

pyownet.protocol.proxy().dir()

but always create  a proxy object at program initialisation and reuse it throughout your script.

Stefano

On 27 Jul 2016, at 21:26, Mick Sulley <[hidden email]> wrote:

Looking at converting my current Python code from owfs to ow-shell.  I
have found a few different Python bindings, any opinions on which one to
use?  Also there does not seem to be much documentation on any of them,
can anyone point me in the right direction?

Thanks

Mick


------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers


------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers


------------------------------------------------------------------------------

_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers