[RELEASED] Python plugin to control Onkyo receivers

Python and python framework

Moderator: leecollings

Post Reply
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: RE: Re: [RELEASED] Python plugin to control Onkyo receivers

Post by jorgh »

jossie67 wrote:
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'
It is a Domoticz plugin and cannot be executed stand-alone.

Attached in the 1st post, there is a stand-alone script.

Regards,

Jorg

Verstuurd vanaf mijn HTC 10 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 »

Hi There Jorgh,

Still love this script. I used to do do this with the stand-alone python script but i was never 100% sure if the command would execute. Now with the receivers feedback it's great.
Any chance that the Favorites are can be chosen like the Tuner presets? I'm not on cable any more and have it attached to the internet. When i want to play a radio station i add the stream to the favorites and select it with the remote.

From Domoticz i used something like this...

C:\Python27\Scripts\onkyo --host 192.168.1.5 system-power:on
C:\Python27\Scripts\onkyo --host 192.168.1.5 volume:15
C:\Python27\Scripts\onkyo --host 192.168.1.5 input-selector:network
C:\Python27\Scripts\onkyo --host 192.168.1.5 internet-radio-preset:%1

Thanks for all the help you are giving us :D
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,
JimmyH1969 wrote: Any chance that the Favorites are can be chosen like the Tuner presets?
I'll need to look at that, I don't use internet radio myself. I'll add some favorites and see if I can read them in a similar fashion as the radio presets. If that it the case, it should not be hard to implement.

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, are you still planning to change the listening mode device, so that it will be filled with listening modes that are selected by the user? I would like to be able to auto-select my favourite listening mode when Kodi plays video or audio

Verstuurd vanaf mijn GT-I9195 met Tapatalk
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:@jorgh, are you still planning to change the listening mode device, so that it will be filled with listening modes that are selected by the user? I would like to be able to auto-select my favourite listening mode when Kodi plays video or audio
Yes I am, i've registered already registered the enhancement on github (https://github.com/jorgh6/domoticz-onkyo-plugin/issues).
But I need to find some time, the change requires some rework on the selection boxes, so it's a bit more work to implement. I've already thought of an approach how to do this. Now we just need to wait for a rainy day ;-)

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 »

Hi Jorgh,

I have your plugin installed and connected to my ONKYO TX-NR626.
After connecting to the plugin, the devices are created and i can control my onkyo, i get feedback so everything works.

But.....
after a day the tuner/plugin seems disconnected and i get the following error's when trying to control the onkyo via domoticz

Code: Select all

Error: Plugin: Async Read Exception: 104, Connection reset by peer
Error: (Onkyo) Transport is not connected, write directive ignored.
Error: (Onkyo) Transport is not connected, write directive ignored.
Error: EventSystem: Could not determine switch type for event device Livingroom
Error: (Onkyo) 'onCommand' failed 'ValueError':'invalid literal for int() with base 10: 'Of''.
Error: (Onkyo) ----> Line 628 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onCommand
Error: (Onkyo) ----> Line 160 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onCommand
Error: (Onkyo) Transport is not connected, write directive ignored.
Error: (Onkyo) Transport is not connected, write directive ignored.
Error: (Onkyo) Transport is not connected, write directive ignored.
Error: (Onkyo) Transport is not connected, write directive ignored.
any idea what is wrong?

my Setup:

RPI2 DOMOTICZ V3.7277 ONKYO TX-NR626

--Edit--
When i'm not home the power gets disconnected from my onkyo...

--Edit2--

After restarting the domoticz service the plugin works again.

Code: Select all

(Onkyo) Receiver found:
(Onkyo) Type: AV Receiver or Stereo Receiver
(Onkyo) Type: TX-NR626
(Onkyo) Region: European or Asian model
Maybe the loss off power could be the reason...


-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,
Plaagje wrote: Maybe the loss off power could be the reason...
I think it is, however the plugin should try to reconnect (haven't tested this). So if you restore power, things should start working again. I'll take a look at the code to see if I can spot why it doesn't reconnect.

Regards,

Jorg
mcwieger
Posts: 107
Joined: Tuesday 08 December 2015 9:59
Target OS: NAS (Synology & others)
Domoticz version: 2020.1
Location: Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by mcwieger »

I started using this plugin on my Synology, but it does not seem to work. After adding the hardware the devices are not added. When I check the log, the following error is displayed:

Code: Select all

2017-04-11 09:14:58.306 Error: (Onkyo Receiver) failed to parse parameters, Message or Message,Verb,URL,Headers,Delay expected.
2017-04-11 09:14:58.307 Error: (Onkyo Receiver) 'PyDomoticz_Send' failed 'TypeError':'argument 1 must be str, not bytes'.
FYI using plugins appears to have done some damage, as I cannot remove the hardware anymore (both this plugin and Buienradar), when I try to I get an error message and Domoticz is stopped...

Help appreciated :-)
I moved to HomeAssistant. It was fun while it lasted!
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 »

@mcwieger,
mcwieger wrote:I started using this plugin on my Synology, but it does not seem to work. After adding the hardware the devices are not added. When I check the log, the following error is displayed:

Code: Select all

2017-04-11 09:14:58.306 Error: (Onkyo Receiver) failed to parse parameters, Message or Message,Verb,URL,Headers,Delay expected.
2017-04-11 09:14:58.307 Error: (Onkyo Receiver) 'PyDomoticz_Send' failed 'TypeError':'argument 1 must be str, not bytes'.
FYI using plugins appears to have done some damage, as I cannot remove the hardware anymore (both this plugin and Buienradar), when I try to I get an error message and Domoticz is stopped...

Help appreciated :-)
What is the Domoticz version you are using? The minimum required version is 3.7040.

Regards,

Jorg
mcwieger
Posts: 107
Joined: Tuesday 08 December 2015 9:59
Target OS: NAS (Synology & others)
Domoticz version: 2020.1
Location: Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by mcwieger »

Ah, that's probably it. I'm on 3.6749, which is the highest version available for DSM 6.0 at the moment...

I stopped early-adopting new releases of both Domoticz and DSM because they control the entire house now, but I'll give it a shot.

Thanks for your quick reply.
I moved to HomeAssistant. It was fun while it lasted!
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:@Plaagje,
Plaagje wrote: Maybe the loss off power could be the reason...
I think it is, however the plugin should try to reconnect (haven't tested this). So if you restore power, things should start working again. I'll take a look at the code to see if I can spot why it doesn't reconnect.

Regards,

Jorg
Hi Jorg,

Even when i do not power off the tuner, the plugin gets disconnected. maybe a wait/sleep issue?

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

mcwieger wrote:I started using this plugin on my Synology, but it does not seem to work.
I think we are in the same boat.. my 515 and your 616 dont support NRI(QSTN). I found a excel(ISCP_AVR_133 (430940).xlsx) from july 2015 and it stated that:
onkyo_nriqstn_support.png
onkyo_nriqstn_support.png (20.83 KiB) Viewed 2651 times
So for our older receivers we need another way to setup these. Some configuration files based on receiver version name perhaps?
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 wrote:
mcwieger wrote:I started using this plugin on my Synology, but it does not seem to work.
I think we are in the same boat.. my 515 and your 616 dont support NRI(QSTN). I found a excel(ISCP_AVR_133 (430940).xlsx) from july 2015 and it stated that:
onkyo_nriqstn_support.png

So for our older receivers we need another way to setup these. Some configuration files based on receiver version name perhaps?
I've registered an enhancement on GitHub for supporting receivers that dont deliver the configuration through the NRI command. https://github.com/jorgh6/domoticz-onkyo-plugin/issues

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 »

A nice improvement would be that if I choose one of the FM favourites, the receiver switches (on) to that input as well.
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:I've registered an enhancement on GitHub for supporting receivers that dont deliver the configuration through the NRI command. https://github.com/jorgh6/domoticz-onkyo-plugin/issues

Regards,

Jorg
Nice, thanks! I'll try to help you some day soon and check if wireshark would tell how the onkyo android app is handling with these older receivers.
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 »

@Plaagje
Plaagje wrote: Even when i do not power off the tuner, the plugin gets disconnected. maybe a wait/sleep issue?
I've updated the code, so it should reconnect after the receiver gets disconnected in the development branch (https://github.com/jorgh6/domoticz-onky ... evelopment) Have you enabled network stand-by? This allows connections to the receiver even when the receiver is turned off. Without it, you're unable to power on the receiver.

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

@Jake,
jake wrote:A nice improvement would be that if I choose one of the FM favourites, the receiver switches (on) to that input as well.
The tuner is shared by all zones (up till 4, the plugin supports 2 zones already). I personally use Zone 2 for listening to Music (Hi-fi speakers connected) and Zone 1 for movies (5.1 speaker setup).

I think you could create a scene or event (lua or blocky) to implement what you want already.

Kind regards,

Jorg
jake
Posts: 742
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: RE: Re: [RELEASED] Python plugin to control Onkyo receivers

Post by jake »

jorgh wrote:@Jake,

The tuner is shared by all zones (up till 4, the plugin supports 2 zones already). I personally use Zone 2 for listening to Music (Hi-fi speakers connected) and Zone 1 for movies (5.1 speaker setup).

I think you could create a scene or event (lua or blocky) to implement what you want already.

Kind regards,

Jorg
True, didn't think about a piece of code or blockly to do that



Verstuurd vanaf mijn GT-I9195 met Tapatalk
burton666
Posts: 85
Joined: Monday 17 August 2015 21:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by burton666 »

I added the script using th instructions and restarted domoticz. After I add the hardware my log gets flooded by:

Onkyo 609) Loading XML from file
2017-04-23 18:38:34.297 (Onkyo 609) XML file does not yet exist
2017-04-23 18:38:36.300 (Onkyo 609) Loading XML from file
2017-04-23 18:38:36.300 (Onkyo 609) XML file does not yet exist
2017-04-23 18:38:38.302 (Onkyo 609) Loading XML from file...
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 »

@burton666,

That is probably because the receiver doesn't support the NRI command, they are not supported at this moment as the XML is the basis for creating the Domoticz devices. In a future release I will add support for these receivers. The enhancement is registered at: https://github.com/jorgh6/domoticz-onky ... n/issues/8

Kind regards,

Jorg
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest