[RELEASED] Python plugin to control Onkyo receivers

Python and python framework

Moderator: leecollings

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,
jake wrote: Wednesday 16 August 2017 0:39 I am able to name my Listening modes, your approach works well. What doesn't work is 'setting' the newly listening modes. I click on the required listening mode, the switch button changes colour, but the receiver doesn't respond. After a refresh, the listening mode is changed back to the one that the receiver actually is on.
I can only use the predefined audio modes, like Movie/TV, Music, Game etc. and toggle through the listening modes. Being able to 'set' a listening mode directly, has been my goal for the longest time.
The code to select these listening modes directly still needs to be added. I plan to do that within the next 2 weeks, have been on a holiday last month, so that's why it has been so quiet ;-)

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 »

@Xavier82,
Xavier82 wrote: Tuesday 05 September 2017 19:28 Did you find some time to create a plugin which supports Onkyo devices without NRI?
Not yet, but the good news is that the way I select the listening modes will be similar to the way the non-NRI support will work. So, once the listening modes work, I'll start working on non NRI support.

Regards,

Jorg
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 »


jorgh wrote:...have been on a holiday last month, so that's why it has been so quiet ;-)
I kinda figured that already and therefore patiently waited for your return ;-)
vanputten80
Posts: 11
Joined: Sunday 04 January 2015 16:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by vanputten80 »

Installed the script on Windows added the hardware and it works! I am able to Switch off/on and set volume for my TX-NR 509
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,

I've updated the development branch on Github. You should now be able to select discovered listening modes.

Regards,

Jorg
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 »

jorgh wrote:@Jake,

I've updated the development branch on Github. You should now be able to select discovered listening modes.

Regards,

Jorg
Thanks a lot. I will test this on Saturday, I am not home until tomorrow late.

UPDATE: I updated the plugin within Domoticz and it works excellent to check and set the different listening modes!!! Now I finally can integrate the listening modes in my script that joints the Kodi mediaplayer and the Onkyo receiver together.
Xavier82
Posts: 178
Joined: Tuesday 07 June 2016 22:09
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by Xavier82 »

Hi Jorgh,

Any news about the update to create a plugin which supports Onkyo devices without NRI?

Hope to hear from you soon.

Thanks!

Kind Regards,
Xavier
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 »

And the possibility to play internet favorites audio streams would be nice :D
swevm
Posts: 23
Joined: Friday 16 September 2016 20:04
Target OS: Raspberry Pi / ODroid
Domoticz version: 8718
Location: Sweden
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by swevm »

Updated to latest Domoticz and development version of Onkyo plugin.

Am receiving this error every now and then in my logs.
2017-11-10 18:08:35.442 Error: (Onkyo AV) 'onCommand' failed 'AttributeError':''NoneType' object has no attribute 'Send''.
2017-11-10 18:08:35.442 Error: (Onkyo AV) ----> Line 871 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onCommand
2017-11-10 18:08:35.442 Error: (Onkyo AV) ----> Line 143 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onCommand

Not sure what it mean as most things seem to be working wine apart som long latency from time to time when I change volume. It may take a few sec before volume is updated at receiver end if I change it in Domoticz UI.

/Magnus
Domoticz on RPi3 with Razberry: 10xZME WALLC-S, 14x Fib Switch, 6x Fib Wallplug, 1x Fib Motion Sensor, 2x Fib Smoke Sensor, 1x Fib Universal sensor (with 1-wire), 3x SwiidInter cordsw, ESPEasy [1-wire and relay], Kodi, Node-Red [Onkyo NR-828, UI etc]
rizzah
Posts: 75
Joined: Monday 17 October 2016 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Groningen
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by rizzah »

Hi,

I am new to domoticz and scripts, but when i try to run the script from the commandline i get this:
pi@Domoticz:~/domoticz/scripts$ python onkyo.py --help
File "onkyo.py", line 588
SyntaxError: Non-ASCII character '\xc2' in file onkyo.py on line 588, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

When i create a dummy switch in domoticz and use your example line from the first post (script:///home/pi/domoticz/scripts/onkyo.py --power on --input 5 --volume 20) as "on action" nothing happens, and in the errorlog i see : Error: Error executing script command (/home/pi/domoticz/scripts/onkyo.py). returned: 512.

Can anyone point me in the right direction to what i am doing wrong?
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 »

Hi rizzah, welcome...

It's not a commandline script. You have to add it to the Plugins directory. Create a directory Onkyo in the plugins directory and copy the script into that directory. Make sure is named "plugin.py"
Restart domoticz and you can add new hardware named: Onkyo AV Receiver
Make sure you have Allow new hardware/sensors enabled
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 »

swevm wrote:Updated to latest Domoticz and development version of Onkyo plugin.

Am receiving this error every now and then in my logs.
2017-11-10 18:08:35.442 Error: (Onkyo AV) 'onCommand' failed 'AttributeError':''NoneType' object has no attribute 'Send''.
2017-11-10 18:08:35.442 Error: (Onkyo AV) ----> Line 871 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onCommand
2017-11-10 18:08:35.442 Error: (Onkyo AV) ----> Line 143 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onCommand

Not sure what it mean as most things seem to be working wine apart som long latency from time to time when I change volume. It may take a few sec before volume is updated at receiver end if I change it in Domoticz UI.

/Magnus
@swevm,

The beta branche is for the latest Domoticz beta. The plugin framework changed, so it is incompatible with the stable release.

Regards,

Jorg

Verstuurd vanaf mijn SM-G950F met Tapatalk

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 »

Good to see you again jorgh, hope you are allright.
Can we expect any changes to the plugin in the (near) feature? :D
rizzah
Posts: 75
Joined: Monday 17 October 2016 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Groningen
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by rizzah »

Thanks!

I had already added that hardware before adding the script, it added 3 devices (power, volume and zone2 power).
Should i re-add it now i have the script in place, will that add more devices then or?
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 wrote: Thursday 16 November 2017 22:27 Good to see you again jorgh, hope you are allright.
Can we expect any changes to the plugin in the (near) feature? :D
@JimmyH1969,

I've configured an internet radio station, to look into the internet radio request. However, it's clearly implemented differently from the normal radio presets. I've not yet figured out how to list the presets and select them. If anyone has info on this it would be helpful.
It should be possible, as the Onkyo app is able to do it.

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 »

rizzah wrote: Thursday 16 November 2017 22:31 Thanks!

I had already added that hardware before adding the script, it added 3 devices (power, volume and zone2 power).
Should i re-add it now i have the script in place, will that add more devices then or?
@rizzah,

I've noticed that the lates Domoticz builds already has (limited) native support for Onkyo. So If you've properly installed the plugin, you should see two hardware types. One is named 'Onkyo LAN', and that's not the plugin. The one named 'Onkyo' is the plugin. It should add more than just power and volume controls. Also inputs, radio presets and surround modes should appear when using the plugin.

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 »

Thanks already for looking into it. I cant wait (read: this will get the wife of my back) to have this feature working :D
Having just the option to select any preset would great already.
Your work is very much appreciated ;)
rizzah
Posts: 75
Joined: Monday 17 October 2016 16:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Groningen
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by rizzah »

Hi Jorg!

I feel kinda dumb, but i only see the Onkyo AV Receiver (LAN). I did what Jimmy said:

pi@Domoticz:~/domoticz/scripts/onkyo$ ls -al
total 44
drwxr-xr-x 2 pi pi 4096 Nov 16 22:22 .
drwxr-xr-x 9 pi pi 4096 Nov 16 22:22 ..
-rwxr-xr-x 1 pi pi 34571 Nov 16 21:34 plugin.py

Created the sub-dir, renamed the python script. Then restarted the server (even did a reboot of the pi). But when i want to add a new hardware device i only see the one Onkyo that was there before i added the script.

Am i missing someting here?
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 »

I'm on a Windows machine, but i can remember you have to some chmod things on the file....

You downloaded the file from github? https://github.com/jorgh6/domoticz-onkyo-plugin
Last edited by JimmyH1969 on Thursday 16 November 2017 22:54, edited 1 time in total.
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 »

@rizzah,

Plugins should be installed in the plugins directory of Domoticz.
On a Pi, this would be /home/domoticz/plugins/onkyo
The plugin should be named plugin.py
Be sure, to fetch the plugin from github.
The main branch is for the stable Domoticz release, the development branche for the latest Domoticz beta.

Regards,

Jorg
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest