[RELEASED] Python plugin to control Onkyo receivers

Python and python framework
Post Reply
jake
Posts: 269
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 » Monday 24 April 2017 20:02

The listening mode switch properly switches from Music to Movie/TV etc, however the 'state' remains off, instead of the selected option. This makes it unusable in scripts, when I check which state is active at the moment. I now use a variable to store the option that I selected with my LUA code, however, this way I am not aware when the listening mode is changed from another source. (actually, I think this is rather complicated with just the 'movie', 'music', 'game' and 'stereo', because I guess that the receiver only announces the actual listening mode, like 'theater-dimensional' or 'All Ch Stereo' instead)

Can you please change the state of this switch to the selected listening mode of this selector switch?

User avatar
jorgh
Posts: 144
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 » Tuesday 25 April 2017 8:52

@Jake,
jake wrote:Can you please change the state of this switch to the selected listening mode of this selector switch?
I'm working on this. The current modes in the control are the ones that the receiver announces in the XML config. However, these modes do 'not really exist' they actually cycle through a number of different actual modes. This is also why the control is not updated. The receiver responds with the actual mode, which is not in the control and hence, cannot be selected.
The complicated thing is that there are according to the protocol a lot of different listening modes exist, but only a small set is supported on each receiver. So here is the plan:

I will add a listening mode to the control when the plugin first receives a listening mode response that is not available in the control. So the control will only contain modes, available on the connected receiver.
This will also open up the possibility to support receivers that don't support the NRI command, to deliver their configuration. I will use the same mechanism for inputs, presets etc.

I'll update this thread, once I update the plugin with this functionality. I will start with the listening modes and add support for receivers not supporting NRI at a later stage.

Kind regards,

Jorg

swevm
Posts: 23
Joined: Friday 16 September 2016 20:04
Target OS: Raspberry Pi
Domoticz version: 7067
Location: Sweden
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by swevm » Tuesday 02 May 2017 22:14

I thought I'd bring up an issue I'm facing. Btw a GitHub issue have been created on this topic.

When for example If Main Source is used in a Domoticz Scene it's not possible to see Input Label as a drop down when defining what source to be set. Instead all labels are translated to a Level, presented in a drop down as percentage number.

Am I the only one seeing this issue?

Btw I have tested to add a virtual selector switch to a scene and if the switch have 4 possible setting they are translated to a Level of 0, 10, 20 and 40% when defining what switch should do when scene is triggered.
Domoticz on RPi3 with Razberry: 10xZME WALLC-S, 10x Fib Switch, 6x Fib Wallplug, 1x Fib Motion Sensor, 1x 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]

User avatar
jorgh
Posts: 144
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 » Wednesday 03 May 2017 9:07

@swevm,
swevm wrote: When for example If Main Source is used in a Domoticz Scene it's not possible to see Input Label as a drop down when defining what source to be set. Instead all labels are translated to a Level, presented in a drop down as percentage number.

Am I the only one seeing this issue?

Btw I have tested to add a virtual selector switch to a scene and if the switch have 4 possible setting they are translated to a Level of 0, 10, 20 and 40% when defining what switch should do when scene is triggered.
As far as I know, this is Domoticz behavior. I agree, that it is not very handy. Especially if there are more than 10 levels, the percentage goes above 100% and you can't even select this when you define a scene. From scripting however, this does not seem to be an issue.

If anybody knows if there is some other kind of selector that does not have this behavior, please drop me a line. I could than alter the plugin. But for now, I don't know a solution.

Regards,

Jorg

swevm
Posts: 23
Joined: Friday 16 September 2016 20:04
Target OS: Raspberry Pi
Domoticz version: 7067
Location: Sweden
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by swevm » Wednesday 03 May 2017 11:15

Thanks Jorgh.

I have tried different various selectors in a Scene. They behave the same all of them even if I change the Scene into a Group as have been suggested in at least on other forum post.

A workaround could be to create switches (by the plugin) that activate specific Inputs and Modes once activated.
Domoticz on RPi3 with Razberry: 10xZME WALLC-S, 10x Fib Switch, 6x Fib Wallplug, 1x Fib Motion Sensor, 1x 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]

Yustmenl
Posts: 43
Joined: Wednesday 28 September 2016 17:26
Target OS: Raspberry Pi
Domoticz version: 3.5997
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by Yustmenl » Wednesday 03 May 2017 15:56

I am just seeing my recever is not supported yet.

a few errors i get are:

Code: Select all

2017-05-03 16:00:06.684 Error: (Onkyo woonkamer) 'onMessage' failed 'AttributeError':''NoneType' object has no attribute 'find''.
2017-05-03 16:00:06.685 Error: (Onkyo woonkamer) ----> Line 624 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onMessage
2017-05-03 16:00:06.685 Error: (Onkyo woonkamer) ----> Line 99 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onMessage
2017-05-03 16:00:06.685 Error: (Onkyo woonkamer) ----> Line 523 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function processeISCPFrame
So now i wan't to remove the device and i get the error
Problem with removing hardware.

any idea how i can remove or disable the device? currenlty it's spamming my log.
Rasberry Pi 3; Razberry 2.0; RFXCOM

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

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

Post by jorgh » Wednesday 03 May 2017 18:55

Yustmenl wrote:I am just seeing my recever is not supported yet.

a few errors i get are:

Code: Select all

2017-05-03 16:00:06.684 Error: (Onkyo woonkamer) 'onMessage' failed 'AttributeError':''NoneType' object has no attribute 'find''.
2017-05-03 16:00:06.685 Error: (Onkyo woonkamer) ----> Line 624 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onMessage
2017-05-03 16:00:06.685 Error: (Onkyo woonkamer) ----> Line 99 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onMessage
2017-05-03 16:00:06.685 Error: (Onkyo woonkamer) ----> Line 523 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function processeISCPFrame
So now i wan't to remove the device and i get the error
Problem with removing hardware.

any idea how i can remove or disable the device? currenlty it's spamming my log.
The errors are probably because your Domoticz version is to old. This causes problems with Domoticz (could even freeze). That is why you cannot remove the hardware.

Things you can try:
1. Restart Domoticz and disable or remove the plugin asap.
2. Update Domoticz, with an updated version, the errors do not occur, and you should be able to disable or remove the plugin.

Regards,

Jorg

Edit: I've checked the code, and the logs you posted are indeed a bug that occurs under some circumstances on receivers not supporting the NRI command. However, restarting domotics and disabling/removing the hardware should work if you do it asap.

Yustmenl
Posts: 43
Joined: Wednesday 28 September 2016 17:26
Target OS: Raspberry Pi
Domoticz version: 3.5997
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by Yustmenl » Friday 05 May 2017 9:46

Option 2 worked for me i gues there was a bug in the version i was running.
Thanks
Rasberry Pi 3; Razberry 2.0; RFXCOM

jake
Posts: 269
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 25 May 2017 13:27

@jorgh, I am curious, are you getting anywhere with the listening modes integration? What about if all listening modes are there, even while not all are supported by each model? I could still detect which one is active and store that listening mode for future use (I simply want to switch mode, depending on Kodi playing 'video' or 'audio'.

User avatar
jorgh
Posts: 144
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 » Monday 29 May 2017 10:29

Hi Jake,
jake wrote:@jorgh, I am curious, are you getting anywhere with the listening modes integration? What about if all listening modes are there, even while not all are supported by each model? I could still detect which one is active and store that listening mode for future use (I simply want to switch mode, depending on Kodi playing 'video' or 'audio'.
I've got the code to detect the listening modes and update the selector. However, there is a bug in Domoticz, that crashes Domoticz when updating selectors from the plugin framework. As such, I've not yet published the update. I think, that this bug needs resolving first. I've already posted on this bug in the forum.

Regards,

Jorg

User avatar
Plaagje
Posts: 65
Joined: Thursday 30 April 2015 10:00
Target OS: Raspberry Pi
Domoticz version: Latest
Location: Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by Plaagje » Tuesday 30 May 2017 18:04

jorgh wrote:@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
Thanx for the update, i have network standby enabled so that was not the problem, i will try the new code.

phd1963
Posts: 1
Joined: Saturday 17 June 2017 3:37
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by phd1963 » Saturday 17 June 2017 3:45

Hi jorgh,

I use your plugin for few weeks without any problem, but since the last Domoticz update (v3.7976) the plugin doesn't work anymore. Here is the log if it can help:

2017-06-17 03:28:01.032 Error: (Onkyo) 'onHeartbeat' failed 'AttributeError':''module' object has no attribute 'Transport''.
2017-06-17 03:28:01.032 Error: (Onkyo) ----> Line 640 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onHeartbeat
2017-06-17 03:28:01.032 Error: (Onkyo) ----> Line 227 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onHeartbeat
2017-06-17 03:28:01.032 Error: (Onkyo) ----> Line 437 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function connect
2017-06-17 03:28:03.036 Error: (Onkyo) 'onHeartbeat' failed 'AttributeError':''module' object has no attribute 'Transport''.
2017-06-17 03:28:03.036 Error: (Onkyo) ----> Line 640 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onHeartbeat
2017-06-17 03:28:03.036 Error: (Onkyo) ----> Line 227 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onHeartbeat
2017-06-17 03:28:03.036 Error: (Onkyo) ----> Line 437 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function connect

This log repeats every 2 seconds and I have to delete Onkyo from Hardware to avoid Domoticz crash.

Thanks for your support.

swevm
Posts: 23
Joined: Friday 16 September 2016 20:04
Target OS: Raspberry Pi
Domoticz version: 7067
Location: Sweden
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by swevm » Saturday 17 June 2017 14:28

phd1963,

You get this error due to changes in underlying Python plugin implementation. It's one of the beauties of running bleeding edge code that stuff can break without notice. In this case it was posted in Python sub forum about this change prior to it being implemented.

you have three options:
- wait until plugin gets updated
- read Python development plugin wiki page and then implementat changes needed yourself in a fork of Jorgh git repo for the plugin
- revert to older Domoticz beta

phd1963 wrote:Hi jorgh,

I use your plugin for few weeks without any problem, but since the last Domoticz update (v3.7976) the plugin doesn't work anymore. Here is the log if it can help:

2017-06-17 03:28:01.032 Error: (Onkyo) 'onHeartbeat' failed 'AttributeError':''module' object has no attribute 'Transport''.
2017-06-17 03:28:01.032 Error: (Onkyo) ----> Line 640 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onHeartbeat
2017-06-17 03:28:01.032 Error: (Onkyo) ----> Line 227 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onHeartbeat
2017-06-17 03:28:01.032 Error: (Onkyo) ----> Line 437 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function connect
2017-06-17 03:28:03.036 Error: (Onkyo) 'onHeartbeat' failed 'AttributeError':''module' object has no attribute 'Transport''.
2017-06-17 03:28:03.036 Error: (Onkyo) ----> Line 640 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onHeartbeat
2017-06-17 03:28:03.036 Error: (Onkyo) ----> Line 227 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onHeartbeat
2017-06-17 03:28:03.036 Error: (Onkyo) ----> Line 437 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function connect

This log repeats every 2 seconds and I have to delete Onkyo from Hardware to avoid Domoticz crash.

Thanks for your support.
Domoticz on RPi3 with Razberry: 10xZME WALLC-S, 10x Fib Switch, 6x Fib Wallplug, 1x Fib Motion Sensor, 1x 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]

jake
Posts: 269
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 » Monday 19 June 2017 8:45

@jorgh, as a daily user of your Onkyo plugin, I am not updating my Domoticz anymore, because of the change in integration of python plugins. Not a problem so far, but just wondering, are you planning to update your plugin? For the Kodi plugin there are now 2 versions, old and new, with the same functionality​.

User avatar
jorgh
Posts: 144
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 » Tuesday 20 June 2017 8:44

@Jake,
jake wrote:As a daily user of your Onkyo plugin, I am not updating my Domoticz anymore, because of the change in integration of python plugins. Not a problem so far, but just wondering, are you planning to update your plugin? For the Kodi plugin there are now 2 versions, old and new, with the same functionality​.
I've already updated the code, but the issue with the updating of selector switches seems to be bigger with the current Beta, also selection of excising levels causes Domoticz to crash.
Dnwppo has updated the code that should resolve the crash. Once the beta is updated, I can test if it resolves the issues. If so, I'll push my updates to GitHub. It will also include the code to add listening modes on first usage.

Regards,

Jorg

User avatar
Plaagje
Posts: 65
Joined: Thursday 30 April 2015 10:00
Target OS: Raspberry Pi
Domoticz version: Latest
Location: Netherlands
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by Plaagje » Friday 23 June 2017 17:22

where can we find the updated code?

i get these error's

Code: Select all

2017-06-23 17:18:40.885 (Onkyo) Receiver found:
2017-06-23 17:18:40.885 (Onkyo) Type: AV Receiver or Stereo Receiver
2017-06-23 17:18:40.885 (Onkyo) Type: TX-NR626
2017-06-23 17:18:40.886 (Onkyo) Region: European or Asian model
2017-06-23 17:18:40.886 (Onkyo) IP adress: xxx.xxx.xxx.xxx
2017-06-23 17:18:40.886 (Onkyo) eISCP port: 60128
2017-06-23 17:18:40.886 (Onkyo) MAC: xxxxxxx
2017-06-23 17:18:40.886 Error: (Onkyo) 'onHeartbeat' failed 'AttributeError':''module' object has no attribute 'Transport''.
2017-06-23 17:18:40.886 Error: (Onkyo) ----> Line 640 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onHeartbeat
2017-06-23 17:18:40.886 Error: (Onkyo) ----> Line 227 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function onHeartbeat
2017-06-23 17:18:40.886 Error: (Onkyo) ----> Line 437 in /home/pi/domoticz/plugins/Onkyo/plugin.py, function connect

User avatar
jorgh
Posts: 144
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 » Saturday 24 June 2017 11:20

@Plaagje,
Plaagje wrote:where can we find the updated code?
It is not yet release, as Domoticz crashes when using the version with the updated code. As soon as the bug is resolved (either my plugin or Domoticz) I'll put it on GitHub.

Regards,

Jorg

User avatar
mrefex
Posts: 25
Joined: Tuesday 14 March 2017 15:15
Target OS: Raspberry Pi
Domoticz version: 3.7041
Contact:

Re: [RELEASED] Python plugin to control Onkyo receivers

Post by mrefex » Thursday 06 July 2017 8:23

to be sure...there is no way to control your onkyo anymore?


v3.7976

User avatar
jorgh
Posts: 144
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 » Friday 07 July 2017 8:44

@mrefex and others,
mrefex wrote:to be sure...there is no way to control your onkyo anymore?
I've updated the development branch with the code compatible with the new connection object in the Python framework.
On my Pi however, Domoticz crashes (signal 11, segmentation fault) when the plugin is enabled. I believe this is not caused by an error in the plugin, but somewhere in the python framework, but you should never exclude that possibility ;-).

The Master branch still contains a stable version, but this will only work on Domoticz versions prior to the connection object change.

Maybe someone could take a look, it's always easy to overlook you own mistakes ;-)

So for now, controlling the Onkyo will work on older Domoticz versions using the Master branch version.

Kind regards,

Jorg

User avatar
jorgh
Posts: 144
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 13 July 2017 9:10

All,

I've seen that the issue does not occur on versions of Domoticz you compile yourself. I've confirmed this myself as have others. So for now, compiling Domoticz from source yourself seems to be the solution.

Regards,

Jorg

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest