[RELEASED] Python plugin to control Onkyo receivers

Python and python framework

Moderator: leecollings

JimmyH1969
Posts: 153
Joined: Tuesday 28 June 2016 16:38
Target OS: Windows
Domoticz version: Beta
Location: Amersfoort NL
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by jake »

Could it have to do with 'enable new hardware' as well?
User avatar
jorgh
Posts: 124
Joined: Friday 27 June 2014 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8224
Location: Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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
JimmyH1969
Posts: 153
Joined: Tuesday 28 June 2016 16:38
Target OS: Windows
Domoticz version: Beta
Location: Amersfoort NL
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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')


:?
User avatar
jorgh
Posts: 124
Joined: Friday 27 June 2014 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8224
Location: Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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
User avatar
jorgh
Posts: 124
Joined: Friday 27 June 2014 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8224
Location: Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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
JimmyH1969
Posts: 153
Joined: Tuesday 28 June 2016 16:38
Target OS: Windows
Domoticz version: Beta
Location: Amersfoort NL
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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
User avatar
jorgh
Posts: 124
Joined: Friday 27 June 2014 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8224
Location: Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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
pj-r
Posts: 140
Joined: Wednesday 17 December 2014 17:30
Target OS: Linux
Domoticz version: V3.8650
Location: Jyväskylä, Finland
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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?
LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors
User avatar
jorgh
Posts: 124
Joined: Friday 27 June 2014 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8224
Location: Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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
pj-r
Posts: 140
Joined: Wednesday 17 December 2014 17:30
Target OS: Linux
Domoticz version: V3.8650
Location: Jyväskylä, Finland
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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 :)
LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors
User avatar
Plaagje
Posts: 42
Joined: Thursday 30 April 2015 10:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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.
User avatar
jorgh
Posts: 124
Joined: Friday 27 June 2014 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8224
Location: Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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
User avatar
Plaagje
Posts: 42
Joined: Thursday 30 April 2015 10:00
Target OS: Raspberry Pi / ODroid
Domoticz version: Latest
Location: Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by Plaagje »

I added an other plugin and that one didnt load as well,,,, i suppose it is the plugin system.
oohlaf
Posts: 21
Joined: Monday 06 February 2017 0:57
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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
jossie67
Posts: 39
Joined: Wednesday 31 December 2014 12:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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
Raspberry Pi (3x)
Master Domoticz installed on a Synology
RFXCOM RFXtrx433E USB
RFLink
USB Z-Wave Mini Adapter
Mi-light
QuinLED
Landis+Gyr ZME120ACd
Kamstrup_M401
USB-IR-Schreib-Lesekopf Alecto WS1700
Watermeter with TCRT5000
Kodi
DS18B20
oohlaf
Posts: 21
Joined: Monday 06 February 2017 0:57
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by oohlaf »

You need python 3
User avatar
jorgh
Posts: 124
Joined: Friday 27 June 2014 23:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8224
Location: Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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
jossie67
Posts: 39
Joined: Wednesday 31 December 2014 12:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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 ,
Raspberry Pi (3x)
Master Domoticz installed on a Synology
RFXCOM RFXtrx433E USB
RFLink
USB Z-Wave Mini Adapter
Mi-light
QuinLED
Landis+Gyr ZME120ACd
Kamstrup_M401
USB-IR-Schreib-Lesekopf Alecto WS1700
Watermeter with TCRT5000
Kodi
DS18B20
jossie67
Posts: 39
Joined: Wednesday 31 December 2014 12:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post 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'
Raspberry Pi (3x)
Master Domoticz installed on a Synology
RFXCOM RFXtrx433E USB
RFLink
USB Z-Wave Mini Adapter
Mi-light
QuinLED
Landis+Gyr ZME120ACd
Kamstrup_M401
USB-IR-Schreib-Lesekopf Alecto WS1700
Watermeter with TCRT5000
Kodi
DS18B20
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest