Page 4 of 14

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Wednesday 29 March 2017 20:57
by JimmyH1969
just tried some commands to be sure:

onkyo-script.py --host 192.168.1.5 system-power=on
returns...
<eISCP(TX-NR646) 192.168.1.5:60128> PWR01
<'system-power', 'on'>

(The device does turn on)

onkyo-script.py --discover
returns...
(nothing) ;)

Hope this makes any sense. I'll try to find out why the discover function does not work, it's not a firewall thing.

to be continued, tnx

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Wednesday 29 March 2017 23:08
by jake
Could it have to do with 'enable new hardware' as well?

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Thursday 30 March 2017 9:25
by jorgh
jake wrote:Could it have to do with 'enable new hardware' as well?
Not in this case, as the devices are created after receiving the Receiver configuration. As the discovery process fails, the Receiver is not even connected yet.

Regards,

Jorg

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Thursday 30 March 2017 12:31
by JimmyH1969
It seems i'm not the only one: https://github.com/miracle2k/onkyo-eiscp/issues/59

I just installed python on a fresh windows pc and executed "onkyo-script.py --discover"
it returns:
Traceback (most recent call last):
File "C:\Python27\Scripts\onkyo-script.py", line 9, in <module>
load_entry_point('onkyo-eiscp==1.0', 'console_scripts', 'onkyo')()
File "C:\Python27\lib\site-packages\eiscp\script.py", line 134, in run
sys.exit(main() or 0)
File "C:\Python27\lib\site-packages\eiscp\script.py", line 50, in main
for receiver in eISCP.discover(timeout=1):
File "C:\Python27\lib\site-packages\eiscp\core.py", line 323, in discover
data, addr = sock.recvfrom(1024)
socket.error: [Errno 10054] An existing connection was forcibly closed by the remote host


Executing "onkyo-script.py --host 192.168.1.5 system-power:query"
Returns:
<eISCP(TX-NR646) 192.168.1.5:60128>: PWRQSTN
('system-power', 'standby')


:?

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Friday 31 March 2017 8:43
by jorgh
@JimmyH1969,

I've installed Python on a windows machine and found out that windows does not supper the MSG_DONTWAIT flag.
So in my code the auto discover will definitely not work on Windows at this moment.
I'll change the code so this will work on Windows. But I don't yet know if this is the only issue. After I figure out a method that works on both Windows and Linux, I'll update the code in the bugfix branch.

Regards,

Jorg

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Friday 31 March 2017 9:17
by jorgh
@JimmyH1969,

I've made some changes that should make the autodiscover work on Windows. Have not tested it myself, as I don't have Domoticz running on a windows host. Verified the principle using a standalone script, so I'm confident the changes resolve the issue I found.
Don't know if that is the only issue that is keeping you from auto discovery, as apparently none of the existing scripts work on your install. Nevertheless, the changes are required on Windows.

The new code is currently in the bugfix branch: https://github.com/jorgh6/domoticz-onky ... ree/bugfix

Regards,

Jorg

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Friday 31 March 2017 11:18
by JimmyH1969
:D :D :D :D :D
Very, very nice.....

I updated the plugin remotely from work so i cant see the receivers responses, but it does detect the receiver and the devices are created.
Thank you for all the hard work and the great result ofcourse.

Can you explain what you changed to make discovery work? ;)

Thanks again!

Regards, Jimmy

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Friday 31 March 2017 11:34
by jorgh
@Jimmy
JimmyH1969 wrote::D :D :D :D :D
Very, very nice.....

I updated the plugin remotely from work so i cant see the receivers responses, but it does detect the receiver and the devices are created.
Thank you for all the hard work and the great result ofcourse.
Well, that is good news indeed.
Can you explain what you changed to make discovery work? ;)

I already did ;-)
https://github.com/jorgh6/domoticz-onky ... n/issues/6
https://github.com/jorgh6/domoticz-onky ... 14daeb8fa9

Regards,

Jorg

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Friday 31 March 2017 19:07
by pj-r
jorgh wrote:The receiver configuration is requested using an NRIQSTN command. The response contains the receiver configuration in XML, that I use to create the devices.
Douh.. my TX-NR515 doesnt support that method or at least ISCP-V1.26_2013.xlsx file claims so.
Is there any alternative way?

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Friday 31 March 2017 20:05
by jorgh
@pj-r,
pj-r wrote:Douh.. my TX-NR515 doesnt support that method or at least ISCP-V1.26_2013.xlsx file claims so.
Is there any alternative way?
In this plugin I use this information, as the input numbers and names differ a lot between models, it is the easiest way to create the devices with correct information. The plugin as it is currently programmed does not work without a proper NRI response from the receiver.

The plugin could be adapted to create the devices with all possible values, where the user could then delete unused inputs etc. I would then create a configuration option to indicate a receiver without NRI support is used.

I would give it a try with the current version, you never know, maybe it works. I see that there is a recent (2015) firmware on the onkyo website. As far as I can tell, the onkyo remote app, also uses the XML. So if that works, chances are that there is no issue and the XLS file is incorrect.

Regards,

Jorg

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Friday 31 March 2017 23:01
by pj-r
Sounds like its time for wireshark since the onkyo android app works fine.

I did try the NRIQSTN with this piece of python code and i always get timeout:

Code: Select all

import eiscp
receiver = eiscp.eISCP('192.168.1.10')
response = receiver.raw('NRIQSTN');
print response
receiver.disconnect()
response is:

Code: Select all

pjr@pjr:~$ python testOnkyo.py
Traceback (most recent call last):
  File "testOnkyo.py", line 10, in <module>
    response = receiver.raw('NRIQSTN');
  File "build/bdist.linux-armv7l/egg/eiscp/core.py", line 436, in raw
  File "build/bdist.linux-armv7l/egg/eiscp/core.py", line 259, in filter_for_message
ValueError: Timeout waiting for response.
this "ValueError: Timeout waiting for response." is coming from the python lib.. https://github.com/miracle2k/onkyo-eisc ... re.py#L265

Other methods that are marked as supported in excel file are working just fine. And I have the latest firmware update installed.

For me it looks like this 515 doesnt really support NRI -> QSTN method. Let see what the wireshark has to say :)

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Saturday 01 April 2017 1:15
by Plaagje
jorgh wrote:Installation instructions:
Unzip the plugin.zip file and put plugin.py within a folder named 'Onkyo' in the Domoticz plugin folder.
On Linux make the file executable (chmod a+x plugin.py)

After you installed the plugin, restart Domoticz and add the Onkyo Receiver through the Setup->Hardware.
Hi!

I did the above but i cant seem to find the onkyo receiver under Hardware...

Im running Domoticz V3.7041 on a Pi 2.

-Plaagje.

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Sunday 02 April 2017 10:19
by jorgh
@Plaagje,

Did you create the Onkyo directory with a capital 'O'?
If not, try renaming the directory.

Do other plugins work (or at least show up in add-hardware)?

If not, it's probably a generic issue with plugins not working, and not something specific to this plugin.

Regards,

Jorg

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Sunday 02 April 2017 13:00
by Plaagje
I added an other plugin and that one didnt load as well,,,, i suppose it is the plugin system.

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Sunday 02 April 2017 13:58
by oohlaf
The directory name does not matter. Any name will do as long as the files are readable by the user under which Domoticz runs. The files do not need to be executable, chmod +r is enough.

Verstuurd vanaf mijn XT1562 met Tapatalk

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Wednesday 05 April 2017 15:05
by jossie67
Has anyone this also working on a synolgy.
I have Python 2.7 running.

But when I do

Code: Select all

python Onkyo-plugin.py --host 192.168.10.74 --discover
I get an error

Code: Select all

SyntaxError: Non-ASCII character '\xc3' in file Onkyo-plugin.py on line 569, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Wednesday 05 April 2017 19:49
by oohlaf
You need python 3

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Wednesday 05 April 2017 20:02
by jorgh
@jossie67,
jossie67 wrote:Has anyone this also working on a synolgy.
I have Python 2.7 running.

But when I do

Code: Select all

python Onkyo-plugin.py --host 192.168.10.74 --discover
I get an error

Code: Select all

SyntaxError: Non-ASCII character '\xc3' in file Onkyo-plugin.py on line 569, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
That is neither the plugin or command script posted in this thread.

Regards,

Jorg

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Thursday 06 April 2017 16:05
by jossie67
oohlaf wrote:You need python 3
Thanks that make sense!

jorgh wrote:@jossie67,

That is neither the plugin or command script posted in this thread.

Regards,

Jorg
I rename you python script "plugin.py" to 'Onkyo-plugin.py ,

Re: [RELEASED] Python plugin to control Onkyo receivers

Posted: Thursday 06 April 2017 16:21
by jossie67
jossie67 wrote:
oohlaf wrote:You need python 3
Thanks that make sense!

jorgh wrote:@jossie67,

That is neither the plugin or command script posted in this thread.

Regards,

Jorg
I rename you python script "plugin.py" to 'Onkyo-plugin.py ,
Now I can run the python script, I'm only missing module named 'Domoticz'