[RELEASED] Python plugin to control Onkyo receivers

Python and python framework
rizzah
Posts: 45
Joined: Monday 17 October 2016 16:11
Target OS: Raspberry Pi
Domoticz version:
Location: Groningen
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by rizzah » Friday 17 November 2017 9:58

@jorgh, @jimmy

Thanks for your help! It didn't work after your last post Jorgh, so i did a bit of googling on python scripts and domoticz. Came across (https://www.domoticz.com/wiki/Using_Python_plugins) turned out i did not have python3 installed yet. After i installed it i saw the new hardware.

One more thing, i see it uses auto scan feature, this is of course super handy, if you have a single ip-network. However i use different vlans, so a scan wont work. Is it possible to manually add an IP-adress/port?

Thanks again!
Peter

JimmyH1969
Posts: 80
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 » Friday 17 November 2017 17:09

jorgh wrote:
Thursday 16 November 2017 23:36
JimmyH1969 wrote:
Thursday 16 November 2017 23: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
Hi Jorg,

Looking at the ISCP commands, selecting presets is done by:

"NPR" - Internet Radio Preset Command
"01"-"28" sets Preset No. 1 - 40 ( In hexadecimal representation)
"SET" preset memory current station

How to enummerate them seems abacadabra to me :shock:

JimmyH1969
Posts: 80
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 » Wednesday 22 November 2017 11:13

Jorg. Is it possible to create just a switch to select the internet radio preset? To do this now i'm using a external executable. The downsite is that if i use that external execuatble it seems that your plugin loses it connection to the receiver and the plugin needs to be restarted.

jake
Posts: 286
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi
Domoticz version: beta
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by jake » Thursday 23 November 2017 0:18

@Jorg,

Just dialing in to tell you that the plugin in the current state is working fine in my setup. It's in use every day, even to such an extent that when dzVents was disabled for some reason, my wife didn't remember anymore how to operate the receiver since Domoticz with your plugin takes care of that normally.

So a thumbs up from my side!

JimmyH1969
Posts: 80
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 » Thursday 23 November 2017 17:45

I agree, the plugin is great. Expanding functionality would be great, so maybe just another request to add to my whislist ..... :D

Would it be possible to create something to send any command to the receiver?
Like sending the command "MVLUP" for example using a LUA script or something?

dwmw2
Posts: 46
Joined: Thursday 03 December 2015 13:42
Target OS: Linux
Domoticz version:
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by dwmw2 » Friday 24 November 2017 16:24

Hi Jorgh,

It looks like you did this around the same time I did — in February I started putting together Onkyo support too, which got merged into the latest stable release of Domoticz. It's native C++ support, because I'm running in a resource-constrained environment (an OpenWRT router) and the dependencies for Python are huge. If we could have lua plugins, that would be much nicer!

You've got a bit further than me though; you have supported the NRIQSTN command and parsed the XML to create the devices automatically.
Would you be interested in merging the extra support you have into Domoticz itself?

EDIT 2017-11-25:

I've just added the XML status support to the native hardware support: https://github.com/domoticz/domoticz/pull/1960

JimmyH1969
Posts: 80
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 » Tuesday 28 November 2017 15:26

Hi dwmw2,

I have been testing your Onkyo native plugin in my Test Domoticz environment and it works really wel,
When i look at the Domoticz log when playing Spotify on the receiver, i see a lot of these messages:

Code: Select all

2017-11-28 13:48:43.552 OnkyoAVTCP: Packet received: 21 NTM00:02:06/00:02:11 
2017-11-28 13:48:44.602 OnkyoAVTCP: Packet received: 21 NTM00:02:07/00:02:11 
2017-11-28 13:48:45.652 OnkyoAVTCP: Packet received: 21 NTM00:02:08/00:02:11 
2017-11-28 13:48:46.702 OnkyoAVTCP: Packet received: 21 NTM00:02:09/00:02:11 
2017-11-28 13:48:47.752 OnkyoAVTCP: Packet received: 21 NTM00:02:10/00:02:11 
2017-11-28 13:48:48.802 OnkyoAVTCP: Packet received: 21 NTM00:02:11/00:02:11 
2017-11-28 13:48:49.852 OnkyoAVTCP: Packet received: 6 NJAn- 
2017-11-28 13:48:49.852 OnkyoAVTCP: Packet received: 7 NSTP-- 
2017-11-28 13:48:49.852 OnkyoAVTCP: Packet received: 15 NATSt. Vincent 
2017-11-28 13:48:49.852 OnkyoAVTCP: Packet received: 17 NALStrange Mercy 
2017-11-28 13:48:49.852 OnkyoAVTCP: Packet received: 15 NTICheerleader 
2017-11-28 13:48:49.853 OnkyoAVTCP: Packet received: 14 NMSxxxxxS10A 
2017-11-28 13:48:49.853 OnkyoAVTCP: Packet received: 6 NJAn- 
2017-11-28 13:48:49.853 OnkyoAVTCP: Packet received: 21 NTM--:--:--/00:02:11 
2017-11-28 13:48:50.902 OnkyoAVTCP: Packet received: 21 NTM00:00:01/00:03:28 
2017-11-28 13:48:50.902 OnkyoAVTCP: Packet received: 252 
So it is actually catching the events the receiver is sending. Is it (going to be) possible to use these events and put them in a text sensor for example?
NAT = Artist Name, NAL = Album Name, NTI = Title and NTM = Time info. I think adding these to variables would be great if possible.
Also sending RAW commands to the receiver would be great. The volume slider for example is tricky for the ears, so i would like to send a MVLUP for example. The possibility to select Internet Radio presets would be great as well. I also asked Jorgh if that's gonna be possible.
Expanding functionallity would be great i think.

Thanks!

dwmw2
Posts: 46
Joined: Thursday 03 December 2015 13:42
Target OS: Linux
Domoticz version:
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by dwmw2 » Tuesday 28 November 2017 21:52

JimmyH1969 wrote:
Tuesday 28 November 2017 15:26
So it is actually catching the events the receiver is sending. Is it (going to be) possible to use these events and put them in a text sensor for example?
NAT = Artist Name, NAL = Album Name, NTI = Title and NTM = Time info. I think adding these to variables would be great if possible.
https://github.com/domoticz/domoticz/pull/1971

Image
JimmyH1969 wrote:
Tuesday 28 November 2017 15:26
Also sending RAW commands to the receiver would be great. The volume slider for example is tricky for the ears, so i would like to send a MVLUP for example. The possibility to select Internet Radio presets would be great as well.
https://github.com/dwmw2/domoticz/commits/onkyo-cmd

Code: Select all

http://${DOMOTICZ}/json.htm?type=command&param=onkyoeiscpcommand&idx=${IDX}&action=MVLUP
Where ${IDX} is any logical device belonging to the Onkyo. And `MVLUP` is any command you want to send (needs to be an admin user).

User avatar
Varazir
Posts: 192
Joined: Friday 20 February 2015 23:23
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by Varazir » Tuesday 28 November 2017 23:47

I'm getting this in my log, nothing shows in the device list.

Code: Select all

2017-11-28 22:44:19.485 (Onkyo) Started.
2017-11-28 22:44:20.691 (Onkyo) Initialized version 0.2.1, author 'jorgh'
2017-11-28 22:44:20.691 (Onkyo) Entering work loop.
2017-11-28 22:44:32.244 (Onkyo) Receiver found:
2017-11-28 22:44:32.245 (Onkyo) Type: AV Receiver or Stereo Receiver
2017-11-28 22:44:32.245 (Onkyo) Type: TX-NR509
2017-11-28 22:44:32.245 (Onkyo) Region: European or Asian model
2017-11-28 22:44:32.245 (Onkyo) IP adress: 192.168.2.30
2017-11-28 22:44:32.245 (Onkyo) eISCP port: 60128
2017-11-28 22:44:32.246 (Onkyo) MAC: 0009B0C6F4D6
2017-11-28 22:44:34.229 (Onkyo) Loading XML from file
2017-11-28 22:44:34.241 (Onkyo) XML file does not yet exist
2017-11-28 22:44:36.207 (Onkyo) Loading XML from file
2017-11-28 22:44:36.208 (Onkyo) XML file does not yet exist
2017-11-28 22:44:38.215 (Onkyo) Loading XML from file
2017-11-28 22:44:38.216 (Onkyo) XML file does not yet exist
2017-11-28 22:44:40.224 (Onkyo) Loading XML from file
2017-11-28 22:44:40.225 (Onkyo) XML file does not yet exist
2017-11-28 22:44:42.237 (Onkyo) Loading XML from file
2017-11-28 22:44:42.238 (Onkyo) XML file does not yet exist
1x Raspberry PI A with a RaZberry board
1x GreenWave 6 port Power node
1x tellstick
1x Qubino ZMNHOD1 ( controlling a Ikea blinder )
1x ZW075 Smart Switch Gen5
Several nexa/proove devices

Live Long and Prosper \\//_

JimmyH1969
Posts: 80
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 » Tuesday 28 November 2017 23:56

dwmw2 wrote:
Tuesday 28 November 2017 21:52

https://github.com/dwmw2/domoticz/commits/onkyo-cmd

Code: Select all

http://${DOMOTICZ}/json.htm?type=command&param=onkyoeiscpcommand&idx=${IDX}&action=MVLUP
Where ${IDX} is any logical device belonging to the Onkyo. And `MVLUP` is any command you want to send (needs to be an admin user).
Awesome... This probably works after the commit i guess ;)

dwmw2
Posts: 46
Joined: Thursday 03 December 2015 13:42
Target OS: Linux
Domoticz version:
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by dwmw2 » Wednesday 29 November 2017 17:53

JimmyH1969 wrote:
Tuesday 28 November 2017 23:56
Awesome... This probably works after the commit i guess ;)
Yep, once https://github.com/domoticz/domoticz/pull/1971 is merged, I think it should end up in the next beta build.

I've updated the wiki page at https://www.domoticz.com/wiki/Onkyo

pj-r
Posts: 245
Joined: Wednesday 17 December 2014 18: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 » Thursday 30 November 2017 12:52

Idea: receivers that doest support NRI. Could we create one monster json file that defines all the receivers and what those are supporting. Then another where user can configure everything that comes in xml with NRI command?
Or event better: UI to configure the device? So the basic conf and capabilities comes from json file and the rest user could configure?

Or is it just easier for everyone to buy new receiver :?: :D
Varazir wrote:
Tuesday 28 November 2017 23:47
I'm getting this in my log, nothing shows in the device list.
TX-NR509 does not support NRI-command so its not supported by now. 424, 525, 626... is the first series that supports the NRI command. Google for ISCP_AVR_134.xlsx its a excel file that has information what receiver supports what functionality.
LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors

dwmw2
Posts: 46
Joined: Thursday 03 December 2015 13:42
Target OS: Linux
Domoticz version:
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by dwmw2 » Thursday 30 November 2017 13:01

pj-r wrote:
Thursday 30 November 2017 12:52
Idea: receivers that doest support NRI. Could we create one monster json file that defines all the receivers and what those are supporting.
https://github.com/miracle2k/onkyo-eiscp has that in a machine-readable form already. See
https://github.com/miracle2k/onkyo-eisc ... 3/NT3.yaml for example.

If a receiver doesn't support NRI, how do we know what its model is?

pj-r
Posts: 245
Joined: Wednesday 17 December 2014 18: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 » Thursday 30 November 2017 13:04

dwmw2 wrote:
Thursday 30 November 2017 13:01
https://github.com/miracle2k/onkyo-eiscp has that in a machine-readable form already. See
https://github.com/miracle2k/onkyo-eisc ... 3/NT3.yaml for example.
Ah, nice. Makes things easier :)
dwmw2 wrote:
Thursday 30 November 2017 13:01
If a receiver doesn't support NRI, how do we know what its model is?
Looks like some supported command(perhaps ECN, discovery) already gets that info:

Code: Select all

2017-11-28 22:44:32.245 (Onkyo) Type: AV Receiver or Stereo Receiver
2017-11-28 22:44:32.245 (Onkyo) Type: TX-NR509
Varazir wrote:
Tuesday 28 November 2017 23:47
I'm getting this in my log, nothing shows in the device list.

Code: Select all

2017-11-28 22:44:19.485 (Onkyo) Started.
2017-11-28 22:44:20.691 (Onkyo) Initialized version 0.2.1, author 'jorgh'
2017-11-28 22:44:20.691 (Onkyo) Entering work loop.
2017-11-28 22:44:32.244 (Onkyo) Receiver found:
2017-11-28 22:44:32.245 (Onkyo) Type: AV Receiver or Stereo Receiver
2017-11-28 22:44:32.245 (Onkyo) Type: TX-NR509
2017-11-28 22:44:32.245 (Onkyo) Region: European or Asian model
2017-11-28 22:44:32.245 (Onkyo) IP adress: 192.168.2.30
2017-11-28 22:44:32.245 (Onkyo) eISCP port: 60128
2017-11-28 22:44:32.246 (Onkyo) MAC: 0009B0C6F4D6
2017-11-28 22:44:34.229 (Onkyo) Loading XML from file
2017-11-28 22:44:34.241 (Onkyo) XML file does not yet exist
2017-11-28 22:44:36.207 (Onkyo) Loading XML from file
2017-11-28 22:44:36.208 (Onkyo) XML file does not yet exist
2017-11-28 22:44:38.215 (Onkyo) Loading XML from file
2017-11-28 22:44:38.216 (Onkyo) XML file does not yet exist
2017-11-28 22:44:40.224 (Onkyo) Loading XML from file
2017-11-28 22:44:40.225 (Onkyo) XML file does not yet exist
2017-11-28 22:44:42.237 (Onkyo) Loading XML from file
2017-11-28 22:44:42.238 (Onkyo) XML file does not yet exist
LXC(x64 Ubuntu Xenial), RFXtrx433E, MySensors

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

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by jorgh » Thursday 30 November 2017 13:21

@pr-j, @dwmw2,

That is actually not a bad idea. The receiver type is delivered by the discovery. We could add an XML file per receiver model number that does not support NRI, and load the XML from file instead of the receiver.

Regards,

Jorg

dwmw2
Posts: 46
Joined: Thursday 03 December 2015 13:42
Target OS: Linux
Domoticz version:
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by dwmw2 » Thursday 30 November 2017 13:42

jorgh wrote:
Thursday 30 November 2017 13:21
That is actually not a bad idea. The receiver type is delivered by the discovery. We could add an XML file per receiver model number that does not support NRI, and load the XML from file instead of the receiver.
Ah yes, I hadn't noticed it; the built-in support doesn't do discovery yet and is just configured with the IP/port of the receiver. I should add that. It looks like it doesn't respond to ECNQSTN on the TCP connection; only UDP.

What we don't have is a per-model list of the available inputs (SLI command). Perhaps we could learn those as we go along, when one of them is seen — like your plugin already does for listening modes?

rizzah
Posts: 45
Joined: Monday 17 October 2016 16:11
Target OS: Raspberry Pi
Domoticz version:
Location: Groningen
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by rizzah » Thursday 30 November 2017 16:26

Is there a command we can give to get the whole list and send it somewhere?

dwmw2
Posts: 46
Joined: Thursday 03 December 2015 13:42
Target OS: Linux
Domoticz version:
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by dwmw2 » Thursday 30 November 2017 16:59

rizzah wrote:
Thursday 30 November 2017 16:26
get
We probably just need to iterate over the known SLIxx commands and see which ones elicit a SLIN/A error response, and which ones work.

rizzah
Posts: 45
Joined: Monday 17 October 2016 16:11
Target OS: Raspberry Pi
Domoticz version:
Location: Groningen
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by rizzah » Thursday 30 November 2017 17:22

Ok, im not sure if this has anything to do with it, but i thought it did, when i look at my Onkyo Main Mode, i see it catched alot, but not all (see screenshot).
Screen Shot 2017-11-30 at 16.21.27.jpg
Screen Shot 2017-11-30 at 16.21.27.jpg (52.25 KiB) Viewed 325 times

User avatar
Varazir
Posts: 192
Joined: Friday 20 February 2015 23:23
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by Varazir » Friday 01 December 2017 11:31

I know my AVR isn't supported but just letning you know who it looks now with 3.8759 and plugin 0.2.1

Code: Select all

2017-12-01 10:29:14.711 (OnkyoPlugin) Started.
2017-12-01 10:29:25.965 (OnkyoPlugin) Calling message handler 'onHeartbeat'.
2017-12-01 10:29:25.965 (OnkyoPlugin) onHeartbeat called
2017-12-01 10:29:25.966 (OnkyoPlugin) Creating UDP Socket for sending/receiving discovery data
2017-12-01 10:29:25.967 (OnkyoPlugin) UDP Socket created succesfully
2017-12-01 10:29:25.967 (OnkyoPlugin) Sending UDP discovery packet
2017-12-01 10:29:25.968 (OnkyoPlugin) UDP Discovery packet send succesfully
2017-12-01 10:29:27.978 (OnkyoPlugin) Calling message handler 'onHeartbeat'.
2017-12-01 10:29:27.978 (OnkyoPlugin) onHeartbeat called
2017-12-01 10:29:27.979 (OnkyoPlugin) Checking if discovery data has been received
2017-12-01 10:29:27.980 (OnkyoPlugin) Receiver found:
2017-12-01 10:29:27.980 (OnkyoPlugin) Type: AV Receiver or Stereo Receiver
2017-12-01 10:29:27.981 (OnkyoPlugin) Type: TX-NR509
2017-12-01 10:29:27.981 (OnkyoPlugin) Region: European or Asian model
2017-12-01 10:29:27.981 (OnkyoPlugin) IP adress: 192.168.2.30
2017-12-01 10:29:27.981 (OnkyoPlugin) eISCP port: 60128
2017-12-01 10:29:27.982 (OnkyoPlugin) MAC: 0009B0C6F4D6
2017-12-01 10:29:27.982 (OnkyoPlugin) Connecting to Receiver
2017-12-01 10:29:29.940 (OnkyoPlugin) Calling message handler 'onHeartbeat'.
2017-12-01 10:29:29.940 (OnkyoPlugin) onHeartbeat called
2017-12-01 10:29:31.946 (OnkyoPlugin) Calling message handler 'onHeartbeat'.
1x Raspberry PI A with a RaZberry board
1x GreenWave 6 port Power node
1x tellstick
1x Qubino ZMNHOD1 ( controlling a Ikea blinder )
1x ZW075 Smart Switch Gen5
Several nexa/proove devices

Live Long and Prosper \\//_

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests