PyOhNet and generated proxies
|
08-01-2017, 11:52 PM
(This post was last modified: 09-01-2017 06:07 AM by Latka.)
Post: #1
|
|||
|
|||
PyOhNet and generated proxies
Hi,
I have used the GenProxy class in PyOhNet to generate files with proxies (from SCPD xml files from a device on my network). In order to use these proxies with PyOhNet to invoke actions and subscribe to services, where do I put them? Do I import them or do they become part of PyOhNet? Is there anything else that is needed to do to make everything work? Thanks!! |
|||
09-01-2017, 09:26 PM
(This post was last modified: 09-01-2017 09:28 PM by Latka.)
Post: #2
|
|||
|
|||
RE: PyOhNet and generated proxies
To be a bit more specific,
This is what I've done: I imported the generated proxy .py file Then initialize a device instance like this But when I try to invoke an action or subscribe to an event, I get the following: Proxy error - 1: Unknown What am I missing? Code: from MusicServices_1 import CpProxySchemasUpnpOrgMusicServices1 |
|||
10-01-2017, 02:30 PM
Post: #3
|
|||
|
|||
RE: PyOhNet and generated proxies
(09-01-2017 09:26 PM)Latka Wrote: To be a bit more specific, OK - I think there is some confusion here..... When using PyOhNet you do not require knowledge of the underlying proxies. They are generated internally when the device is started, at which point they are exposed for use. You should not use GenProxy.py, and you do not need to know about the ..Proxy..py files - these are not available unless you have turned the debugging feature on to output them to disk (they normally remain in memory and are never written out). As for your example - note that a proxy is generated for a service. The example indicates that you have a service (singular) called MusicServices (plural) which contains an action called ListAvailableServices. Is it really the case that you have a service with an action to list available services ??? If you need to know the available services, that can be pulled from the device (via device XML) The example in PyOhNet/Test directory called TestControlEventing.py shows how to create a device and access a service. There is a legacy error in this which I will outline below (and fix so that it will become available when ohNet is next published), but once that is fixed this example works. I was running on Windows, and using the TestDvTestBasic.exe device which is built with ohNet - if you need a copy of this (unable to build it yourself) then let me know. Change required to TestControlEventing.py Code: line 44: Expected output when running TestControlEventing.py Code: Device _ohNetTestDevice (device-ohNetTestBasic) |
|||
10-01-2017, 02:54 PM
(This post was last modified: 10-01-2017 04:48 PM by Latka.)
Post: #4
|
|||
|
|||
RE: PyOhNet and generated proxies
Hi rockfather,
Thanks for your reply! Quote:As for your example - note that a proxy is generated for a service.Yes I realize what you're getting at with your comment. However, this is an actual service and action taken from a Sonos device. I Believe a call to ListAvailableServices should return a list of available services like Spotify, TuneIn etc. that the device supports. Also, I understand the way actions are supposed to be called and subscriptions made with PyOhNet from your previous replies, it works a treat with my Linn devices ![]() ![]() ![]() So where would I put the generated .py file that contains the new proxies (and otherwise treat them?), so that actions and subscriptions can be called/subscribed in the same way as the built in Openhome proxies? Thanks a lot for your help ![]() EDIT: I mean proxies generated using GenProxy class and the Write method |
|||
11-01-2017, 01:02 PM
Post: #5
|
|||
|
|||
RE: PyOhNet and generated proxies
(10-01-2017 02:54 PM)Latka Wrote: So where would I put the generated .py file that contains the new proxies (and otherwise treat them?), so that actions and subscriptions can be called/subscribed in the same way as the built in Openhome proxies? The design of PyOhNet means that you do NOT have to worry about any proxies. These are automatically generated at run-time from the device/service XML and are immediately available for your use. Taking your example, I would expect the following to work Code: device.Start() You can check what is available using the 'dir' command Code: device.Start() |
|||
11-01-2017, 10:43 PM
(This post was last modified: 11-01-2017 10:47 PM by Latka.)
Post: #6
|
|||
|
|||
RE: PyOhNet and generated proxies
Thank you very much rockfather! Everything is working now. I had no idea that PyOhNet generates proxies at runtime. That is so clever!
From reading up on OhNet I drew the conclusion that any other proxies than the ones from OpenHome had to be generated in advance. That was obviously wrong. Regarding the Proxy Error -1 Unknown i reported in my first post, it seems to be related to the Sonos device I borrowed from my friend. It reports 3 different upnp devices and I seem to have targeted the wrong one when I got that message. |
|||
12-01-2017, 02:01 PM
Post: #7
|
|||
|
|||
RE: PyOhNet and generated proxies
(11-01-2017 10:43 PM)Latka Wrote: Thank you very much rockfather! Everything is working now. I had no idea that PyOhNet generates proxies at runtime. That is so clever! Glad you got it working |
|||
« Next Oldest | Next Newest »
|